public void TimelineService_Update_Test() { // Arrange Mock<ITimelineDao> mock = new Mock<ITimelineDao>(MockBehavior.Strict); mock.Setup(setup => setup.Update(It.IsAny<Timeline>())); Mock<IContentItemDao> contentItemMock = new Mock<IContentItemDao>(MockBehavior.Strict); TimelineService target = new TimelineService(mock.Object, contentItemMock.Object); Timeline timeline = new Timeline(); // Act target.Update(timeline); mock.Verify(verify => verify.Update(timeline), Times.Once); }
public void TimelineService_Update_DontCatchException_Test() { // Arrange Mock<ITimelineDao> mock = new Mock<ITimelineDao>(MockBehavior.Strict); mock.Setup(setup => setup.Update(It.IsAny<Timeline>())).Throws(new Exception()); Mock<IContentItemDao> contentItemMock = new Mock<IContentItemDao>(MockBehavior.Strict); TimelineService target = new TimelineService(mock.Object, contentItemMock.Object); // Act target.Update(new Timeline()); }