public void Name_IsValid_WhenShorterThan18Characters() { var name = "abcdefghi"; var runner = new Runner(name, "1/2"); var error = runner.Error; error.Should().BeEmpty($"because {name} is less than 18 characters long"); }
public void Odds_IsInvalid_WhenContainsLetters() { var odds = "a/2"; var runner = new Runner("abcde", odds); var error = runner.Error; error.Should().NotBeEmpty($"becuase {odds} contains a letter"); }
public void Name_IsInvalid_WhenLongerThan18Characters() { var name = "abcdefghijklmnopqrstuvwxyz"; var runner = new Runner(name, "1/2"); var error = runner.Error; error.Should().NotBeEmpty($"because {name} is longer than 18 characters"); }
public void Name_IsValid_When18CharactersLong() { var name = "abcdefghijklmnopqr"; var runner = new Runner(name, "1/2"); var error = runner.Error; error.Should().BeEmpty($"because {name} is 18 characters long"); }
public void Name_IsInvalid_WhenEmpty() { var name = String.Empty; var runner = new Runner(name, "1/2"); var error = runner.Error; error.Should().NotBeEmpty($"because {name} is empty"); }
public void GetMargin_CalculatesMarginCorrectly() { var runner = new Runner("Name", "1/2"); Decimal expectedMargin = 100 / (1m / 2m + 1); Decimal margin = runner.GetMargin(); margin.Should().Be(expectedMargin); }
public void Odds_IsInvalid_WhenContainsRealAtStart() { var odds = "1.5/2"; var runner = new Runner("abcde", odds); var error = runner.Error; error.Should().NotBeEmpty($"because {odds} contains a real number"); }
public void Odds_IsValid_WhenInCorrectFormat() { var odds = "1/2"; var runner = new Runner("abcde", odds); var error = runner.Error; error.Should().BeEmpty($"becuase {odds} is a valid odds string"); }
public void Odds_IsInvalid_WhenDoesNotContainForwardSlash() { var odds = "12"; var runner = new Runner("abcde", odds); var error = runner.Error; error.Should().NotBeEmpty($"because {odds} does not contain a forward slash"); }
/// <summary> /// Adds a new <see cref="Runner"/> to <see cref="Runners"/>. /// </summary> public void AddRunner() { if (!_canAddRunner) return; Runner runner = new Runner(String.Format(Language.DefaultRunnerName, Runners.Count + 1), Language.DefaultRunnerOdds); runner.PropertyChanged += Runner_PropertyChanged; Runners.Add(runner); ReCalculateRaceMargin(); _canAddRunner = Runners.Count < _maxRunnerCount; OnPropertyChanged(nameof(CanAddRunner)); }