コード例 #1
0
 public void SaveHourEntryData(HourEntryData hourEntryData)
 {
     if (this.GetHourEntryDataByHourEntryId(hourEntryData.HourEntryId) == null)
     {
         base.InsertData(hourEntryData);
     }
     else
     {
         base.UpdateData(hourEntryData);
     }
 }
コード例 #2
0
        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();
        }
コード例 #3
0
        private Mock<IHourEntryRepository> GetMockHourEntryRepository_ForSaving(HourEntryData hourEntryData)
        {
            Mock<IHourEntryRepository> mockData = new Mock<IHourEntryRepository>();
            mockData.Setup(x => x.SaveHourEntryData(hourEntryData));

            return mockData;
        }