public void SaveHourEntryData(HourEntryData hourEntryData) { if (this.GetHourEntryDataByHourEntryId(hourEntryData.HourEntryId) == null) { base.InsertData(hourEntryData); } else { base.UpdateData(hourEntryData); } }
public void Should_Be_Able_To_Add() { // arrange HourEntryData hourEntryData = new HourEntryData { Comments = "Test Comment", }; Mock<IHourEntryRepository> mockHourEntryRepository = this.GetMockHourEntryRepository_ForSaving(hourEntryData); HourEntryService hourEntryService = new HourEntryService(mockHourEntryRepository.Object); // action hourEntryService.SaveHourEntryData(hourEntryData); // assert mockHourEntryRepository.VerifyAll(); }
private Mock<IHourEntryRepository> GetMockHourEntryRepository_ForSaving(HourEntryData hourEntryData) { Mock<IHourEntryRepository> mockData = new Mock<IHourEntryRepository>(); mockData.Setup(x => x.SaveHourEntryData(hourEntryData)); return mockData; }