public void Post_AddNewFixture() { var matchFixtureGuid = Guid.NewGuid(); var matchFixtureDto = new NewMatchFixtureRequest(); var matchFixture = new MatchFixture(); _mapper.Expect(m => m.Map <NewMatchFixtureRequest, MatchFixture>(matchFixtureDto)).Return(matchFixture); _matchFixtureService.Expect(s => s.Save(matchFixture)).Return(matchFixtureGuid); var result = _controller.Post(matchFixtureDto); Assert.AreEqual(ResponseStatus.Success, result.Status); Assert.AreEqual(matchFixtureGuid, result.Guid); }
public void Put_UpdateExistingMatchFixture() { var matchFixtureDto = new UpdateMatchFixtureRequest { Guid = Guid.NewGuid() }; var matchFixture = new MatchFixture(); _mapper.Expect(m => m.Map <UpdateMatchFixtureRequest, MatchFixture>(matchFixtureDto)).Return(matchFixture); _matchFixtureService.Expect(s => s.Save(matchFixture)).Return(matchFixtureDto.Guid); var result = _controller.Put(matchFixtureDto); Assert.AreEqual(ResponseStatus.Success, result.Status); Assert.AreEqual(matchFixtureDto.Guid, result.Guid); }
public void Post_AddNewFixture() { var matchFixtureGuid = Guid.NewGuid(); var matchFixtureDto = new NewMatchFixtureRequest(); var matchFixture = new MatchFixture(); _mapper.Expect(m => m.Map <NewMatchFixtureRequest, MatchFixture>(matchFixtureDto)).Return(matchFixture); _matchFixtureService.Expect(s => s.Save(matchFixture)).Return(matchFixtureGuid); var result = _controller.Post(matchFixtureDto); Assert.AreEqual(HttpStatusCode.OK, result.StatusCode); // TODO: Test newly added resource URI. //Assert.AreEqual(matchFixtureGuid, result.Guid); }
public void Get_GuidDoesExist() { var matchFixtureDto = new GetMatchFixtureRequest { Guid = Guid.Empty }; var matchFixture = new MatchFixture() { Guid = matchFixtureDto.Guid }; _mapper.Expect(m => m.Map <GetMatchFixtureRequest, MatchFixture>(matchFixtureDto)).Return(matchFixture); _matchFixtureService.Expect(s => s.Find(matchFixture.Guid)).Return(null); var result = _controller.Get(matchFixtureDto); Assert.IsNull(result); }
public void Get_MatchFixtureByGuid() { var matchFixtureDto = new GetMatchFixtureRequest { Guid = Guid.NewGuid() }; var matchFixture = new MatchFixture() { Guid = matchFixtureDto.Guid }; var expectedMatchFixture = new MatchFixtureData(); _mapper.Expect(m => m.Map <GetMatchFixtureRequest, MatchFixture>(matchFixtureDto)).Return(matchFixture); _mapper.Expect(m => m.Map <MatchFixture, MatchFixtureData>(matchFixture)).Return(expectedMatchFixture); _matchFixtureService.Expect(s => s.Find(matchFixtureDto.Guid)).Return(matchFixture); var result = _controller.Get(matchFixtureDto); Assert.AreSame(expectedMatchFixture, result); }
public void Put_UpdateExistingMatchFixture() { var matchFixtureDto = new UpdateMatchFixtureRequest { Guid = Guid.NewGuid() }; var matchFixture = new MatchFixture(); //var newUri = string.Format("http://localhost:8080/MatchFixture/{0}", matchFixtureDto.Guid); _mapper.Expect(m => m.Map <UpdateMatchFixtureRequest, MatchFixture>(matchFixtureDto)).Return(matchFixture); _matchFixtureService.Expect(s => s.Save(matchFixture)).Return(matchFixtureDto.Guid); HttpResponseMessage result = _controller.Put(matchFixtureDto); Assert.AreEqual(HttpStatusCode.NoContent, result.StatusCode); // TODO: Test newly added resource URI. //Assert.AreEqual(newUri, result.Headers.Location); }
public Guid Save(MatchFixture matchFixture) { throw new System.NotImplementedException(); }