public void Post_should_set_lastModified_on_new_announcement() { var model = new Web.Mvc.Models.AnnouncementModel { Date = new DateTime(2015, 12, 30), Title = "test title", Content = "content" }; object o = null; const string location = "http://announcement/x"; urlHelper.Setup(x => x.Link("DefaultApi", It.IsAny <object>())) .Callback <string, object>((route, attr) => o = attr) .Returns(location); var res = announcementsController.PostAnnouncement(model); res.Should().BeOfType <CreatedNegotiatedContentResult <Announcement> >("should respond with created"); var response = (CreatedNegotiatedContentResult <Announcement>)res; response.Content.LastModifiedUtc.Should().BeWithin(1.Seconds()); response.Content.Id.Should().BePositive(); response.Location.Should().Be(new Uri(location)); }
public void Post_should_set_lastModified_on_new_announcement() { var model = new Web.Mvc.Models.AnnouncementModel { Date = new DateTime(2015, 12, 30), Title = "test title", Content = "content" }; object o = null; const string location = "http://announcement/x"; urlHelper.Setup(x => x.Link("DefaultApi", It.IsAny<object>())) .Callback<string, object>((route, attr) => o = attr) .Returns(location); var res = announcementsController.PostAnnouncement(model); res.Should().BeOfType<CreatedNegotiatedContentResult<Announcement>>("should respond with created"); var response = (CreatedNegotiatedContentResult<Announcement>) res; response.Content.LastModifiedUtc.Should().BeWithin(1.Seconds()); response.Content.Id.Should().BePositive(); response.Location.Should().Be(new Uri(location)); }