Ejemplo n.º 1
0
        public void GetAll_ShouldReturnAnICollectionOfWeekSchedules()
        {
            var weekScheduleStub     = new Mock <IEfRepostory <WeekSchedule> >();
            var unitOfWorkStub       = new Mock <IUnitOfWork>();
            var datetimeProviderStub = new Mock <IDatetimeProvider>();
            var dbSetStub            = new Mock <IList <WeekSchedule> >().As <IQueryable <WeekSchedule> >();

            var sut = new WeekScheduleService(weekScheduleStub.Object, unitOfWorkStub.Object, datetimeProviderStub.Object);

            weekScheduleStub.Setup(x => x.All).Returns(dbSetStub.Object);

            var result = sut.GetAll();

            Assert.IsInstanceOf(typeof(ICollection <WeekSchedule>), result);
        }
Ejemplo n.º 2
0
        public void GetAll_ShouldCallWeekScheduleRepoAllPropertyOnce()
        {
            var weekScheduleStub     = new Mock <IEfRepostory <WeekSchedule> >();
            var unitOfWorkStub       = new Mock <IUnitOfWork>();
            var datetimeProviderStub = new Mock <IDatetimeProvider>();

            var dbSetStub = new List <WeekSchedule>().AsQueryable();

            var sut = new WeekScheduleService(weekScheduleStub.Object, unitOfWorkStub.Object, datetimeProviderStub.Object);

            weekScheduleStub.Setup(x => x.All).Returns(dbSetStub);

            var result = sut.GetAll();

            weekScheduleStub.Verify(x => x.All, Times.Once);
        }