AK.F1.Timing.Live.LiveDriver.MatchesName C# (CSharp) Method

MatchesName() public method

Returns a value indicating if the specified string matches this driver's name.
public MatchesName ( string s ) : bool
s string The string to test.
return bool
        public bool MatchesName(string s)
        {
            if(String.Equals(s, Name, StringComparison.Ordinal))
            {
                return true;
            }
            if(s == null || Name == null)
            {
                return false;
            }
            var index = NormalisedName.IndexOf(s, StringComparison.Ordinal);
            return index == 0 || index == 1;
        }

Usage Example

Example #1
0
        public void can_determine_if_matches_drivers_name(string name, string s, bool matches)
        {
            var driver = new LiveDriver(1);

            driver.Name = name;
            Assert.Equal(matches, driver.MatchesName(s));
        }