public void Test1(int firstPlayerScore, int secondPlayerScore, string expectAnswer) { string FirstPlayerName = "PlayerA"; string SecondPlayerName = "PlayerB"; string scoreString = TennisService.Score(FirstPlayerName, SecondPlayerName, firstPlayerScore, secondPlayerScore); Assert.AreEqual(expectAnswer, scoreString); }
public HttpResponseMessage UpdateMatch(PlayerMatchScore model) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } PlayerMatchScore response = TennisService.UpdateMatch(model); return(Request.CreateResponse(HttpStatusCode.OK, response)); }
public HttpResponseMessage DeleteMatch(int id) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } int response = TennisService.DeleteMatch(id); return(Request.CreateResponse(HttpStatusCode.OK, response)); }
public HttpResponseMessage SearchMatches(Search search) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } IEnumerable <Match> response = TennisService.SearchMatches(search); return(Request.CreateResponse(HttpStatusCode.OK, response)); }
public HttpResponseMessage InsertPlayer([FromBody] string name) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } int response = TennisService.InsertPlayer(name); return(Request.CreateResponse(HttpStatusCode.OK, response)); }
public void Player1_WinPoint_When_Score_Thirty_Thirty_Score_ShouldBe_Fourty_Thirty() { // Arrange var service = new TennisService(); // Act Score score = service.Increment(1, (int)GamePoint.Thirty, (int)GamePoint.Thirty); // Assert Assert.IsNotNull(score); score.Player1.PlayerGamePoint.Should().Be(GamePoint.Forty); score.Player2.PlayerGamePoint.Should().Be(GamePoint.Thirty); }
public void Score_ShouldBe_Deuce_When_Player1_WinPoint_And_Player2_Have_Advantage() { // Arrange var service = new TennisService(); // Act Score score = service.Increment(1, (int)GamePoint.Deuce, (int)GamePoint.Advantage); // Assert Assert.IsNotNull(score); score.Player1.PlayerGamePoint.Should().Be(GamePoint.Deuce); score.Player2.PlayerGamePoint.Should().Be(GamePoint.Deuce); }
public void Player2_Win_Game_When_Have_Advantage_Score_ShouldBe_Zero_Zero() { // Arrange var service = new TennisService(); // Act Score score = service.Increment(2, (int)GamePoint.Deuce, (int)GamePoint.Advantage); // Assert Assert.IsNotNull(score); score.Player1.PlayerGamePoint.Should().Be(GamePoint.zero); score.Player2.PlayerGamePoint.Should().Be(GamePoint.zero); }
public void Start_TheGame_Player1_WinPoint_First_Point_ShouldBe_Fivteen_Zero() { // Arrange var service = new TennisService(); // Act Score score = service.Increment(1, (int)GamePoint.zero, (int)GamePoint.zero); // Assert Assert.IsNotNull(score); score.Player1.PlayerGamePoint.Should().Be(GamePoint.Fifteen); score.Player2.PlayerGamePoint.Should().Be(GamePoint.zero); }
public void Player2_Take_Advantage_When_Score_Forty_Forty_Score_ShouldBe_None_Advantage() { // Arrange var service = new TennisService(); // Act Score score = service.Increment(2, (int)GamePoint.Forty, (int)GamePoint.Forty); // Assert Assert.IsNotNull(score); score.Player1.PlayerGamePoint.Should().Be(GamePoint.Deuce); score.Player2.PlayerGamePoint.Should().Be(GamePoint.Advantage); }
public void Player2_Win_Game_When_Score_thirty_Forty_Score_ShouldBe_Zero_Zero() { // Arrange var service = new TennisService(); // Act Score score = service.Increment(2, (int)GamePoint.Thirty, (int)GamePoint.Forty); // Assert Assert.IsNotNull(score); score.Player1.PlayerGamePoint.Should().Be(GamePoint.zero); score.Player2.PlayerGamePoint.Should().Be(GamePoint.zero); }
public void Player2_WinPoint_When_Score_Fivteen_zero__Score_ShouldBe_Fivteen_Fivteen() { // Arrange var service = new TennisService(); // Act Score score = service.Increment(2, (int)GamePoint.Fifteen, (int)GamePoint.zero); // Assert Assert.IsNotNull(score); score.Player1.PlayerGamePoint.Should().Be(GamePoint.Fifteen); score.Player2.PlayerGamePoint.Should().Be(GamePoint.Fifteen); }
public HttpResponseMessage SearchData() { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } PopulateSearch response = new PopulateSearch(); IEnumerable <string> player = TennisService.PlayerSearchBar(); IEnumerable <string> location = TennisService.LocationSearchBar(); IEnumerable <DateTime> date = TennisService.DateSearchBar(); response.Players = player; response.Locations = location; response.Dates = date; return(Request.CreateResponse(HttpStatusCode.OK, response)); }
public void Start_TheGame_Score_ShouldBe_Zero_Zero() { // Arrange var service = new TennisService(); // Act Score score = service.Get(); // Assert Assert.IsNotNull(score); score.Player1.Id.Should().Be(1); score.Player1.Name.Should().Be("Nadal"); score.Player1.PlayerGamePoint.Should().Be(GamePoint.zero); score.Player2.Id.Should().Be(2); score.Player2.Name.Should().Be("Federer"); score.Player2.PlayerGamePoint.Should().Be(GamePoint.zero); }