Пример #1
0
        public async Task FetchAatfByReturnQuarterWindow_GivenMatchingParameters_AatfsShouldBeOrderedByName()
        {
            using (var database = new DatabaseWrapper())
            {
                var helper            = new ModelHelper(database.Model);
                var domainHelper      = new DomainHelper(database.WeeeContext);
                var dataAccess        = new FetchAatfDataAccess(database.WeeeContext, quarterWindowFactory);
                var genericDataAccess = new GenericDataAccess(database.WeeeContext);

                var aatfList = await CreateMultipleAatf(database, FacilityType.Aatf, DateTime.Now, 2019);

                var @return = new Return(aatfList[0].Organisation, new Quarter(2019, QuarterType.Q1), "created", FacilityType.Aatf);

                A.CallTo(() => quarterWindowFactory.GetQuarterWindow(@return.Quarter)).Returns(new QuarterWindow(DateTime.Now.AddDays(1), DateTime.Now.AddDays(1), QuarterType.Q1));

                await genericDataAccess.AddMany <Aatf>(aatfList);

                var returnedAatfList = await dataAccess.FetchAatfByReturnQuarterWindow(@return);

                aatfList.Should().BeInDescendingOrder(m => m.Name);
            }
        }
Пример #2
0
        public async Task FetchAatfByReturnQuarterWindow_GivenMatchingParameters_ReturnedListContainsAatf()
        {
            using (var database = new DatabaseWrapper())
            {
                var helper            = new ModelHelper(database.Model);
                var domainHelper      = new DomainHelper(database.WeeeContext);
                var dataAccess        = new FetchAatfDataAccess(database.WeeeContext, quarterWindowFactory);
                var genericDataAccess = new GenericDataAccess(database.WeeeContext);

                var aatf = await CreateAatf(database, FacilityType.Aatf, DateTime.Now, 2019);

                var @return = new Return(aatf.Organisation, new Quarter(2019, QuarterType.Q1), "created", FacilityType.Aatf);

                A.CallTo(() => quarterWindowFactory.GetQuarterWindow(@return.Quarter)).Returns(new QuarterWindow(DateTime.Now.AddDays(1), DateTime.Now.AddDays(1), QuarterType.Q1));

                await genericDataAccess.AddMany <Aatf>(new List <Aatf>() { aatf });

                var aatfList = await dataAccess.FetchAatfByReturnQuarterWindow(@return);

                aatfList.Should().Contain(aatf);
            }
        }