Пример #1
0
        public async Task FetchSubmittedNonInvoicedMemberUploadsAsync_WithSpecifiedAuthority_OnlyReturnsNonInvoicedMemberUploadsForTheSpecifiedAuthority()
        {
            using (DatabaseWrapper wrapper = new DatabaseWrapper())
            {
                // Arrange
                ModelHelper helper = new ModelHelper(wrapper.Model);

                Weee.Tests.Core.Model.Country country = new Weee.Tests.Core.Model.Country();
                country.Id   = new Guid("FA20ED45-5488-491D-A117-DFC09C9C1BA2");
                country.Name = "Test Country";

                CompetentAuthority databaseAuthority1 = new CompetentAuthority();
                databaseAuthority1.Id                 = new Guid("DDE398F6-809E-416D-B70D-B36606F221FC");
                databaseAuthority1.Name               = "Test Authority 1";
                databaseAuthority1.Abbreviation       = "T1";
                databaseAuthority1.Country            = country;
                databaseAuthority1.Email              = "TestEmailAddress";
                databaseAuthority1.AnnualChargeAmount = 0;
                wrapper.Model.CompetentAuthorities.Add(databaseAuthority1);

                var scheme = helper.CreateScheme();

                scheme.CompetentAuthorityId = databaseAuthority1.Id;
                var memberUpload = helper.CreateSubmittedMemberUpload(scheme);
                wrapper.Model.SaveChanges();

                UKCompetentAuthority domainAuthority1 = wrapper.WeeeContext.UKCompetentAuthorities.Find(databaseAuthority1.Id);
                CommonDataAccess     dataAccess       = new CommonDataAccess(wrapper.WeeeContext);

                // Act
                IReadOnlyList <Domain.Scheme.MemberUpload> results = await dataAccess.FetchSubmittedNonInvoicedMemberUploadsAsync(domainAuthority1);

                // Assert
                Assert.NotNull(results);
                Assert.Equal(1, results.Count);
                Assert.Equal(memberUpload.Id, results[0].Id);
            }
        }
        public async Task FetchSubmittedNonInvoicedMemberUploadsAsync_WithSpecifiedAuthority_OnlyReturnsNonInvoicedMemberUploadsForTheSpecifiedAuthority()
        {
            using (DatabaseWrapper wrapper = new DatabaseWrapper())
            {
                // Arrange
                ModelHelper helper = new ModelHelper(wrapper.Model);
              
                Weee.Tests.Core.Model.Country country = new Weee.Tests.Core.Model.Country();
                country.Id = new Guid("FA20ED45-5488-491D-A117-DFC09C9C1BA2");
                country.Name = "Test Country";

                CompetentAuthority databaseAuthority1 = new CompetentAuthority();
                databaseAuthority1.Id = new Guid("DDE398F6-809E-416D-B70D-B36606F221FC");
                databaseAuthority1.Name = "Test Authority 1";
                databaseAuthority1.Abbreviation = "T1";
                databaseAuthority1.Country = country;
                databaseAuthority1.Email = "TestEmailAddress";
                wrapper.Model.CompetentAuthorities.Add(databaseAuthority1);
                
                var scheme = helper.CreateScheme();
                
                scheme.CompetentAuthorityId = databaseAuthority1.Id;             
                var memberUpload = helper.CreateSubmittedMemberUpload(scheme);              
                wrapper.Model.SaveChanges();

                UKCompetentAuthority domainAuthority1 = wrapper.WeeeContext.UKCompetentAuthorities.Find(databaseAuthority1.Id);
                CommonDataAccess dataAccess = new CommonDataAccess(wrapper.WeeeContext);

                // Act
                IReadOnlyList<Domain.Scheme.MemberUpload> results = await dataAccess.FetchSubmittedNonInvoicedMemberUploadsAsync(domainAuthority1);

                // Assert
                Assert.NotNull(results);
                Assert.Equal(1, results.Count);
                Assert.Equal(memberUpload.Id, results[0].Id);
            }
        }