public void MakeNewGameWhenRedPlayerNumberIsMinusOneShoudReturn400() { var unitOfwork = Mock.Create<IApplicationData>(); var game = new Game { RedPlayerNumber = -1 }; var server = new InMemoryHttpServer(InMemoryServerUrl, unitOfwork); var response = server.CreatePostRequest(ApiArticles, game); Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode); }
public void MakeNewGameWhenBluePlayerNumberIsMinusOneShoudReturn400() { var unitOfwork = Mock.Create <IApplicationData>(); var bug = new Game { BluePlayerNumber = -1 }; var server = new InMemoryHttpServer(InMemoryServerUrl, unitOfwork); var response = server.CreatePostRequest(ApiArticles, bug); Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode); }
public void MakeNewGameShoudReturn201AndLocationHeader() { var unitOfwork = Mock.Create <IApplicationData>(); var article = new Game { Name = "validName" }; Mock.Arrange(() => unitOfwork.Games.Add(Arg.IsAny <Game>())).Returns(() => article); var server = new InMemoryHttpServer(InMemoryServerUrl, unitOfwork); var response = server.CreatePostRequest(ApiArticles, article); Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); Assert.IsNotNull(response.Headers.Location); }
public void MakeNewGameShoudReturn201AndLocationHeader() { var unitOfwork = Mock.Create<IApplicationData>(); var article = new Game { Name = "validName" }; Mock.Arrange(() => unitOfwork.Games.Add(Arg.IsAny<Game>())).Returns(() => article); var server = new InMemoryHttpServer(InMemoryServerUrl, unitOfwork); var response = server.CreatePostRequest(ApiArticles, article); Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); Assert.IsNotNull(response.Headers.Location); }