コード例 #1
0
        public void Put_FailsWithMissingGuid()
        {
            var matchFixtureDto = new UpdateMatchFixtureRequest();
            var result          = _controller.Put(matchFixtureDto);

            Assert.AreEqual(HttpStatusCode.BadRequest, result.StatusCode);
        }
コード例 #2
0
        public void Put_FailsWithMissingGuid()
        {
            var matchFixtureDto = new UpdateMatchFixtureRequest();

            var result = _controller.Put(matchFixtureDto);

            Assert.AreEqual(ResponseStatus.Failure, result.Status);
            Assert.AreEqual(Guid.Empty, result.Guid);
        }
コード例 #3
0
        public HttpResponseMessage Put(UpdateMatchFixtureRequest updateMatchFixtureRequest)
        {
            // TODO: Send back validation errors
            if (updateMatchFixtureRequest.Guid == Guid.Empty)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            var matchFixture = _mapper.Map <UpdateMatchFixtureRequest, MatchFixture>(updateMatchFixtureRequest);

            _matchFixtureService.Save(matchFixture);

            return(Request.CreateResponse(HttpStatusCode.NoContent, matchFixture));
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }