コード例 #1
0
        public void ShouldAddLeaveThatIsNotADuplicateWithNoPublicHolidaysInBetweenTest()
        {
            uowMock.Setup(x => x.Leaves.GetWhere(It.IsAny <Expression <Func <Leave, bool> > >()))
            .Returns(new List <Leave>().AsQueryable());
            uowMock.Setup(x => x.PublicHolidays.GetWhere(It.IsAny <Expression <Func <PublicHoliday, bool> > >()))
            .Returns(new List <PublicHoliday>().AsQueryable());
            uowMock.Setup(x => x.Leaves.Add(It.IsAny <Leave>()));
            uowMock.Setup(x => x.Save()).Returns(1);
            var manager = new LeaveManager(uowMock.Object, publicHolidaysManager.Object);
            var results = manager.AddLeave(DataUtilities.GetMockedLeaveToAdd());

            uowMock.Verify(x => x.Leaves.Add(It.IsAny <Leave>()), Times.Once());
            uowMock.Verify(x => x.Save(), Times.Once());
        }