Пример #1
0
        public async Task FetchAatfByApprovalNumber_GivenApprovalNumber_ReturnedShouldBeAatf(Core.AatfReturn.FacilityType type)
        {
            FacilityType facilityType;

            if (type == Core.AatfReturn.FacilityType.Aatf)
            {
                facilityType = FacilityType.Aatf;
            }
            else
            {
                facilityType = FacilityType.Ae;
            }

            using (var database = new DatabaseWrapper())
            {
                ModelHelper         helper            = new ModelHelper(database.Model);
                DomainHelper        domainHelper      = new DomainHelper(database.WeeeContext);
                FetchAatfDataAccess dataAccess        = new FetchAatfDataAccess(database.WeeeContext, quarterWindowFactory);
                GenericDataAccess   genericDataAccess = new GenericDataAccess(database.WeeeContext);

                string approvalNumber = "test";

                Aatf aatf = await CreateAatf(database, facilityType, DateTime.Now, 2019, approvalNumber);

                await genericDataAccess.Add(aatf);

                Aatf result = await dataAccess.FetchByApprovalNumber(approvalNumber);

                Assert.NotNull(result);
                Assert.Equal(approvalNumber, result.ApprovalNumber);
                Assert.Equal(facilityType, result.FacilityType);
            }
        }
Пример #2
0
        public async Task FetchAatfByApprovalNumber_GivenApprovalNumberThatExistForCY_ReturnedShouldNotBeNull()
        {
            using (var database = new DatabaseWrapper())
            {
                ModelHelper         helper            = new ModelHelper(database.Model);
                DomainHelper        domainHelper      = new DomainHelper(database.WeeeContext);
                FetchAatfDataAccess dataAccess        = new FetchAatfDataAccess(database.WeeeContext, quarterWindowFactory);
                GenericDataAccess   genericDataAccess = new GenericDataAccess(database.WeeeContext);

                string approvalNumber = "test";

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

                await genericDataAccess.Add(aatf);

                Aatf result = await dataAccess.FetchByApprovalNumber(approvalNumber, 2019);

                Assert.NotNull(result);
            }
        }