public void Non_Existent_HourEntry_ID_Should_Get_No_Records() { // arrange int hourEntryId = 0; Mock<IHourEntryRepository> mockHourEntryRepository = this.GetMockHourEntryRepository_GetRecord(hourEntryId); HourEntryService hourEntryService = new HourEntryService(mockHourEntryRepository.Object); // action HourEntryData hourEntryData = hourEntryService.GetHourEntryDataByHourEntryId(hourEntryId); // assert Assert.That(hourEntryData, Is.Null, "Should be no hour entry data (NULL)"); mockHourEntryRepository.VerifyAll(); }
public void With_Valid_HourEntry_ID_Should_Be_Able_To_Get_Record() { // arrange int hourEntryId = 1; Mock<IHourEntryRepository> mockHourEntryRepository = this.GetMockHourEntryRepository_GetRecord(hourEntryId); HourEntryService hourEntryService = new HourEntryService(mockHourEntryRepository.Object); // action HourEntryData hourEntryData = hourEntryService.GetHourEntryDataByHourEntryId(hourEntryId); // assert Assert.That(hourEntryData.HourEntryId, Is.EqualTo(1), "Hour ID Wrong"); Assert.That(hourEntryData.Hours, Is.EqualTo(1.5M), "Hours Wrong"); Assert.That(hourEntryData.StartDate, Is.EqualTo(DateTime.Today), "Start Date Wrong Wrong"); Assert.That(hourEntryData.EndDate, Is.EqualTo(DateTime.Today), "End Date Wrong Wrong"); Assert.That(hourEntryData.ProjectId, Is.EqualTo(hourEntryId), "Project ID Wrong"); Assert.That(hourEntryData.Comments, Is.EqualTo("This is a Test."), "Comments Wrong"); mockHourEntryRepository.VerifyAll(); }