public void ShouldBeAbletoCloseIncident() { //Preparing IPublisher publisherStub = new PublisherStub(); var subj = new SecondStep_Stubs(publisherStub); var incident = new IncidentData { IsClosed = false }; //Test subj.CloseIncident(incident); //Assert Assert.IsTrue(incident.IsClosed, "Incident Should be closed"); }
public void ShouldSendNotificationOnClosingOpenIncident() { var publisherMock = Substitute.For <IPublisher>(); //This is the mock var subj = new SecondStep_Stubs(publisherMock); var incident = new IncidentData { IsClosed = false }; //Test subj.CloseIncident(incident); //Assert Assert.IsTrue(incident.IsClosed, "Incident Should be closed"); publisherMock.Received(1).Publish(Arg.Any <INotificationData>()); }
public void ShouldSetDateTimeCorrectlyOnCloseIncident() { var publisherMock = Substitute.For <IPublisher>(); //This is the mock var subj = new SecondStep_Stubs(publisherMock); //Shimming var expectedTime = new DateTime(2017, 2, 26, 11, 30, 00); System.Prig.PDateTime.NowGet().Body = () => expectedTime; var test = DateTime.Now; var incident = new IncidentData { IsClosed = false }; subj.CloseIncident(incident); //Assert Assert.AreEqual(expectedTime, incident.LastActivityTime); }