当前位置: 首页>>代码示例>>C#>>正文


C# ModelHelper.CreateProducerAsCompany方法代码示例

本文整理汇总了C#中ModelHelper.CreateProducerAsCompany方法的典型用法代码示例。如果您正苦于以下问题:C# ModelHelper.CreateProducerAsCompany方法的具体用法?C# ModelHelper.CreateProducerAsCompany怎么用?C# ModelHelper.CreateProducerAsCompany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModelHelper的用法示例。


在下文中一共展示了ModelHelper.CreateProducerAsCompany方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute_HappyPath_ReturnsProducerEeeDataHistory

        public async Task Execute_HappyPath_ReturnsProducerEeeDataHistory()
        {
            using (DatabaseWrapper db = new DatabaseWrapper())
            {
                //Arrange
                ModelHelper helper = new ModelHelper(db.Model);
                var scheme1 = helper.CreateScheme();
                scheme1.ApprovalNumber = "WEE/TE0000ST/SCH";
                var memberUpload1 = helper.CreateSubmittedMemberUpload(scheme1);
                memberUpload1.ComplianceYear = 2000;

                var producer1 = helper.CreateProducerAsCompany(memberUpload1, "PRN123");
                producer1.ObligationType = "B2B";
                var dataReturnVersion1 = helper.CreateDataReturnVersion(scheme1, 2000, 1);
                dataReturnVersion1.SubmittedDate = new DateTime(2015, 1, 6);
                var dataReturnVersion2 = helper.CreateDataReturnVersion(scheme1, 2000, 2);
                dataReturnVersion2.SubmittedDate = new DateTime(2015, 1, 8);

                helper.CreateEeeOutputAmount(dataReturnVersion1, producer1.RegisteredProducer, "B2B", 1, 100);
                helper.CreateEeeOutputAmount(dataReturnVersion2, producer1.RegisteredProducer, "B2B", 2, 200);

                var scheme2 = helper.CreateScheme();
                scheme2.ApprovalNumber = "WEE/TE0000S1/SCH";
                var memberUpload2 = helper.CreateSubmittedMemberUpload(scheme2);
                memberUpload2.ComplianceYear = 2000;

                var producer2 = helper.CreateProducerAsCompany(memberUpload2, "PRN123");
                producer2.ObligationType = "B2C";
                var dataReturnVersion3 = helper.CreateDataReturnVersion(scheme2, 2000, 1);
                dataReturnVersion1.SubmittedDate = new DateTime(2015, 1, 9);
                var dataReturnVersion4 = helper.CreateDataReturnVersion(scheme2, 2000, 2);
                dataReturnVersion4.SubmittedDate = new DateTime(2015, 1, 10);

                helper.CreateEeeOutputAmount(dataReturnVersion3, producer2.RegisteredProducer, "B2C", 1, 40);
                helper.CreateEeeOutputAmount(dataReturnVersion4, producer2.RegisteredProducer, "B2C", 2, 1000);

                db.Model.SaveChanges();

                // Act
                var results = await db.StoredProcedures.SpgProducerEeeHistoryCsvData("PRN123");

                //Assert
                Assert.NotNull(results);

                ProducerEeeHistoryCsvData.ProducerInReturnsResult b2cProducer = results.ProducerReturnsHistoryData.Find(x => (x.ApprovalNumber == "WEE/TE0000S1/SCH"));
                Assert.NotNull(b2cProducer);
                Assert.Equal(2000, b2cProducer.ComplianceYear);
                Assert.Equal(1000, b2cProducer.Cat2B2C);
                Assert.Equal("Yes", b2cProducer.LatestData);

                ProducerEeeHistoryCsvData.ProducerInReturnsResult b2bProducer = results.ProducerReturnsHistoryData.Find(x => (x.ApprovalNumber == "WEE/TE0000ST/SCH"));
                Assert.NotNull(b2bProducer);
                Assert.Equal(2000, b2bProducer.ComplianceYear);
                Assert.Equal(200, b2bProducer.Cat2B2B);
                Assert.Null(b2bProducer.Cat2B2C);
                Assert.Equal("Yes", b2bProducer.LatestData);

                Assert.Equal(4, results.ProducerReturnsHistoryData.Count);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:60,代码来源:SpgProducerEeeDataHistoryCsvTests.cs

示例2: using

        public async void SpgSubmissionChangesCsvData_ReturnsProducerAsNew_WhenExistingProducerUploadButNoSubmissionForSameYearAndScheme()
        {
            using (var database = new DatabaseWrapper())
            {
                // Arrange
                ModelHelper modelHelper = new ModelHelper(database.Model);

                var scheme = modelHelper.CreateScheme();

                var memberUpload1 = modelHelper.CreateSubmittedMemberUpload(scheme);
                memberUpload1.ComplianceYear = 2016;
                memberUpload1.IsSubmitted = false;

                modelHelper.CreateProducerAsCompany(memberUpload1, "1111");

                var memberUpload2 = modelHelper.CreateSubmittedMemberUpload(scheme);
                memberUpload2.ComplianceYear = 2016;

                modelHelper.CreateProducerAsCompany(memberUpload2, "1111");

                database.Model.SaveChanges();

                StoredProcedures storedProcedures = new StoredProcedures(database.WeeeContext);

                // Act
                var result = await storedProcedures.SpgSubmissionChangesCsvData(memberUpload2.Id);

                // Assert
                Assert.Single(result);
                Assert.Equal("New", result[0].ChangeType);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:32,代码来源:SpgSubmissionChangesCsvDataTests.cs

示例3: Execute_ReturnsInvoicedProducers_Only

        public async Task Execute_ReturnsInvoicedProducers_Only()
        {
            using (DatabaseWrapper db = new DatabaseWrapper())
            {
                ModelHelper helper = new ModelHelper(db.Model);

                var scheme = helper.CreateScheme();

                var invoiceRun = helper.CreateInvoiceRun();

                var memberUpload = helper.CreateSubmittedMemberUpload(scheme, invoiceRun);
                memberUpload.ComplianceYear = 2016;

                var producer1 = helper.CreateProducerAsCompany(memberUpload, "PRN123");
                producer1.ChargeThisUpdate = 10;
                producer1.Invoiced = true;

                var producer2 = helper.CreateProducerAsCompany(memberUpload, "PRN567");
                producer2.ChargeThisUpdate = 10;
                producer2.Invoiced = false;

                db.Model.SaveChanges();

                var result = await db.StoredProcedures.SpgInvoiceRunChargeBreakdown(invoiceRun.Id);

                Assert.Single(result);
                Assert.Equal("PRN123", result.Single().PRN);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:29,代码来源:SpgInvoiceRunChargeBreakdownTests.cs

示例4: Fetch_ReturnsDataForSpecifiedComplianceYearOnly

        public async Task Fetch_ReturnsDataForSpecifiedComplianceYearOnly()
        {
            using (DatabaseWrapper database = new DatabaseWrapper())
            {
                // Arrange
                ModelHelper helper = new ModelHelper(database.Model);

                var scheme = helper.CreateScheme();
                var memberUpload1 = helper.CreateSubmittedMemberUpload(scheme);
                memberUpload1.ComplianceYear = 2016;

                var producer1 = helper.CreateProducerAsCompany(memberUpload1, "AAA");

                var memberUpload2 = helper.CreateSubmittedMemberUpload(scheme);
                memberUpload2.ComplianceYear = 2017;
                var producer2 = helper.CreateProducerAsCompany(memberUpload2, "AAA");

                database.Model.SaveChanges();

                var dataAccess = new GetProducerDetailsDataAccess(database.WeeeContext);

                // Act
                var result = await dataAccess.Fetch("AAA", 2016);

                // Assert
                Assert.Single(result);
                Assert.Equal(2016, result.Single().RegisteredProducer.ComplianceYear);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:29,代码来源:GetProducerDetailsDataAccessTests.cs

示例5: DataAccess_ReturnsOnlyB2CSchemeForProducer_WhenTheyAreRegisteredB2BandB2COverTwoSchemesInCurrentYear

        public async void DataAccess_ReturnsOnlyB2CSchemeForProducer_WhenTheyAreRegisteredB2BandB2COverTwoSchemesInCurrentYear()
        {
            using (var db = new DatabaseWrapper())
            {
                //Arrange
                ModelHelper helper = new ModelHelper(db.Model);
                var scheme1 = helper.CreateScheme();
                scheme1.ApprovalNumber = "WEE/TE0001ST/SCH";
                var scheme2 = helper.CreateScheme();
                scheme2.ApprovalNumber = "WEE/TE0002ST/SCH";

                //Previous Year Data
                //This test is registering the producer over two schemes in the previous year as well as the current
                //year to test the additional complexity
                var memberUpload2000s1 = helper.CreateSubmittedMemberUpload(scheme1);
                memberUpload2000s1.ComplianceYear = 2000;
                var prod1_2000s1 = helper.CreateProducerAsCompany(memberUpload2000s1, "PRN123", "B2B");
                var dataReturnVersion1 = helper.CreateDataReturnVersion(scheme1, 2000, 1);
                helper.CreateEeeOutputAmount(dataReturnVersion1, prod1_2000s1.RegisteredProducer, "B2B", 1, 500);

                var memberUpload2000s2 = helper.CreateSubmittedMemberUpload(scheme2);
                memberUpload2000s2.ComplianceYear = 2000;
                var prod1_2000s2 = helper.CreateProducerAsCompany(memberUpload2000s2, "PRN123", "B2C");
                var dataReturnVersion2 = helper.CreateDataReturnVersion(scheme2, 2000, 1);
                helper.CreateEeeOutputAmount(dataReturnVersion2, prod1_2000s2.RegisteredProducer, "B2C", 1, 70);

                //Current Year Data
                var memberUpload2001s1 = helper.CreateSubmittedMemberUpload(scheme1);
                memberUpload2001s1.ComplianceYear = 2001;
                var prod1_2001s1 = helper.CreateProducerAsCompany(memberUpload2001s1, "PRN123", "B2C");
                var dataReturnVersion3 = helper.CreateDataReturnVersion(scheme1, 2001, 1);
                helper.CreateEeeOutputAmount(dataReturnVersion3, prod1_2001s1.RegisteredProducer, "B2C", 1, 5000);

                var memberUpload2001s2 = helper.CreateSubmittedMemberUpload(scheme2);
                memberUpload2001s2.ComplianceYear = 2001;
                helper.CreateProducerAsCompany(memberUpload2001s2, "PRN123", "B2B");

                db.Model.SaveChanges();

                // Act
                GetSchemeObligationCsvDataProcessor obligationDataAccess = new GetSchemeObligationCsvDataProcessor(db.WeeeContext);
                var results = await obligationDataAccess.FetchObligationsForComplianceYearAsync(2001);

                // Assert
                Assert.NotNull(results);

                Assert.Equal(1, results.Count);
                SchemeObligationCsvData result1 = results.Find(x => (x.ApprovalNumber == "WEE/TE0001ST/SCH"));
                Assert.Equal("PRN123", result1.PRN);
                Assert.Equal("B2C", result1.ObligationTypeForPreviousYear);
                Assert.Equal("B2C", result1.ObligationTypeForSelectedYear);
                Assert.Equal(70, result1.Cat1B2CTotal);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:54,代码来源:GetSchemeObligationDataCsvHandlerTests.cs

示例6: Execute_HappyPath_ReturnsProducerEeeForPreviousYear

        public async Task Execute_HappyPath_ReturnsProducerEeeForPreviousYear()
        {
            using (DatabaseWrapper db = new DatabaseWrapper())
            {
                //Arrange
                ModelHelper helper = new ModelHelper(db.Model);
                var scheme = helper.CreateScheme();
                scheme.ApprovalNumber = "WEE/TE0000ST/SCH";

                //Previous Year Data
                var memberUpload2000 = helper.CreateSubmittedMemberUpload(scheme);
                memberUpload2000.ComplianceYear = 2000;
                var prod1_2000 = helper.CreateProducerAsCompany(memberUpload2000, "PRN123", "B2C");
                var prod2_2000 = helper.CreateProducerAsCompany(memberUpload2000, "PRN456", "B2B");
                var dataReturnVersion1 = helper.CreateDataReturnVersion(scheme, 2000, 1);
                var dataReturnVersion2 = helper.CreateDataReturnVersion(scheme, 2000, 2);
                helper.CreateEeeOutputAmount(dataReturnVersion1, prod1_2000.RegisteredProducer, "B2C", 1, 100);
                helper.CreateEeeOutputAmount(dataReturnVersion2, prod1_2000.RegisteredProducer, "B2C", 2, 1000);
                helper.CreateEeeOutputAmount(dataReturnVersion1, prod2_2000.RegisteredProducer, "B2B", 2, 400);

                //Current Year Data
                var memberUpload2001 = helper.CreateSubmittedMemberUpload(scheme);
                memberUpload2001.ComplianceYear = 2001;
                var prod1_2001 = helper.CreateProducerAsCompany(memberUpload2001, "PRN123", "B2C");
                var prod2_2001 = helper.CreateProducerAsCompany(memberUpload2001, "PRN456", "B2B");
                var dataReturnVersion3 = helper.CreateDataReturnVersion(scheme, 2001, 1);
                var dataReturnVersion4 = helper.CreateDataReturnVersion(scheme, 2001, 2);
                helper.CreateEeeOutputAmount(dataReturnVersion3, prod1_2001.RegisteredProducer, "B2C", 1, 3000);
                helper.CreateEeeOutputAmount(dataReturnVersion4, prod1_2001.RegisteredProducer, "B2C", 2, 600);
                helper.CreateEeeOutputAmount(dataReturnVersion3, prod2_2001.RegisteredProducer, "B2B", 2, 9000);

                db.Model.SaveChanges();

                // Act
                var results = await db.StoredProcedures.SpgSchemeObligationDataCsv(2001);

                //Assert
                Assert.NotNull(results);

                //Producer with only B2B (both years) should not be in data
                SchemeObligationCsvData b2bProducer = results.Find(x => (x.PRN == "PRN456"));
                Assert.Null(b2bProducer);

                Assert.Equal(1, results.Count);
                SchemeObligationCsvData result = results[0];
                Assert.Equal("test scheme name", result.SchemeName);
                Assert.Equal("WEE/TE0000ST/SCH", result.ApprovalNumber);
                Assert.Equal("PRN123", result.PRN);
                Assert.Equal(100, result.Cat1B2CTotal);
                Assert.Equal(1000, result.Cat2B2CTotal);
                Assert.Null(result.Cat3B2CTotal);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:53,代码来源:SpgSchemeObligationCsvDataTests.cs

示例7: Execute_ReturnsCorrectTotalsForCategories_OfB2COnlyForPreviousYearOfCorrectProducer

        public async Task Execute_ReturnsCorrectTotalsForCategories_OfB2COnlyForPreviousYearOfCorrectProducer()
        {
            using (DatabaseWrapper db = new DatabaseWrapper())
            {
                //Arrange
                ModelHelper helper = new ModelHelper(db.Model);
                var scheme = helper.CreateScheme();
                scheme.ApprovalNumber = "WEE/TE0000ST/SCH";

                //Previous Year Data
                var memberUpload2000 = helper.CreateSubmittedMemberUpload(scheme);
                memberUpload2000.ComplianceYear = 2000;
                var prod1_2000 = helper.CreateProducerAsCompany(memberUpload2000, "PRN123", "Both");
                var prod2_2000 = helper.CreateProducerAsCompany(memberUpload2000, "PRN456", "B2C");
                var dataReturnVersion1 = helper.CreateDataReturnVersion(scheme, 2000, 1);
                var dataReturnVersion2 = helper.CreateDataReturnVersion(scheme, 2000, 2);
                helper.CreateEeeOutputAmount(dataReturnVersion1, prod1_2000.RegisteredProducer, "B2C", 1, 100); // Prod1 Cat1 B2C Q1
                helper.CreateEeeOutputAmount(dataReturnVersion1, prod1_2000.RegisteredProducer, "B2C", 2, 500); // Prod1 Cat2 B2C Q1
                helper.CreateEeeOutputAmount(dataReturnVersion2, prod1_2000.RegisteredProducer, "B2C", 2, 1000); // Prod1 Cat2 B2C Q2
                helper.CreateEeeOutputAmount(dataReturnVersion1, prod1_2000.RegisteredProducer, "B2B", 2, 50); // Prod1 Cat2 B2B Q1
                helper.CreateEeeOutputAmount(dataReturnVersion1, prod2_2000.RegisteredProducer, "B2C", 2, 400); // Prod2 Cat2 B2C Q1

                //Current Year Data
                var memberUpload2001 = helper.CreateSubmittedMemberUpload(scheme);
                memberUpload2001.ComplianceYear = 2001;
                var prod1_2001 = helper.CreateProducerAsCompany(memberUpload2001, "PRN123", "B2C");
                var prod2_2001 = helper.CreateProducerAsCompany(memberUpload2001, "PRN456", "B2B");
                var dataReturnVersion3 = helper.CreateDataReturnVersion(scheme, 2001, 1);
                var dataReturnVersion4 = helper.CreateDataReturnVersion(scheme, 2001, 2);
                helper.CreateEeeOutputAmount(dataReturnVersion3, prod1_2001.RegisteredProducer, "B2C", 1, 3000);
                helper.CreateEeeOutputAmount(dataReturnVersion4, prod1_2001.RegisteredProducer, "B2C", 2, 600);
                helper.CreateEeeOutputAmount(dataReturnVersion3, prod2_2001.RegisteredProducer, "B2B", 2, 9000);

                db.Model.SaveChanges();

                // Act
                var results = await db.StoredProcedures.SpgSchemeObligationDataCsv(2001);

                //Assert
                Assert.NotNull(results);
                Assert.Equal(2, results.Count);

                SchemeObligationCsvData firstProducer = results.Find(x => (x.PRN == "PRN123"));

                Assert.Equal("PRN123", firstProducer.PRN);
                Assert.Equal(100, firstProducer.Cat1B2CTotal);
                Assert.Equal(1500, firstProducer.Cat2B2CTotal);
                Assert.Null(firstProducer.Cat3B2CTotal);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:50,代码来源:SpgSchemeObligationCsvDataTests.cs

示例8: Fetch_ReturnsDataForSubmittedProducerOnly

        public async Task Fetch_ReturnsDataForSubmittedProducerOnly()
        {
            using (DatabaseWrapper database = new DatabaseWrapper())
            {
                // Arrange
                ModelHelper helper = new ModelHelper(database.Model);

                var scheme = helper.CreateScheme();
                var memberUpload = helper.CreateMemberUpload(scheme);
                memberUpload.ComplianceYear = 2016;
                memberUpload.IsSubmitted = false;

                var producer = helper.CreateProducerAsCompany(memberUpload, "AAA");

                database.Model.SaveChanges();

                var dataAccess = new GetProducerDetailsDataAccess(database.WeeeContext);

                // Act
                var result = await dataAccess.Fetch("AAA", 2016);

                // Assert
                Assert.Empty(result);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:25,代码来源:GetProducerDetailsDataAccessTests.cs

示例9: GetLatestProducerEeeData_ReturnsNull_WhenDataNotAvailableForSpecifiedProducer

        public async Task GetLatestProducerEeeData_ReturnsNull_WhenDataNotAvailableForSpecifiedProducer()
        {
            using (DatabaseWrapper database = new DatabaseWrapper())
            {
                // Arrange
                var helper = new ModelHelper(database.Model);

                var organisation = helper.CreateOrganisation();
                var scheme = helper.CreateScheme(organisation);

                var memberUpload = helper.CreateSubmittedMemberUpload(scheme);
                memberUpload.ComplianceYear = 2016;

                var producer = helper.CreateProducerAsCompany(memberUpload, "WEE/MM0001AA");

                var dataReturnVersion = helper.CreateDataReturnVersion(scheme, 2016, 1, isSubmitted: true);
                var producerEee = helper.CreateEeeOutputAmount(dataReturnVersion, producer.RegisteredProducer, "B2C", 1, 1000);

                database.Model.SaveChanges();

                // Act
                var querySet = new SchemeEeeDataQuerySet(organisation.Id, "2016", database.WeeeContext);
                var result = await querySet.GetLatestProducerEeeData("WEE/MM0001BB");

                // Assert
                Assert.Null(result);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:28,代码来源:SchemeEeeDataQuerySetTests.cs

示例10: GetComplianceYears_DoesNotReturnUnsubmittedUploads

        public async Task GetComplianceYears_DoesNotReturnUnsubmittedUploads()
        {
            using (DatabaseWrapper database = new DatabaseWrapper())
            {
                // Arrange
                ModelHelper helper = new ModelHelper(database.Model);

                var scheme = helper.CreateScheme();
                var memberUpload = helper.CreateMemberUpload(scheme);
                memberUpload.ComplianceYear = 2016;
                memberUpload.IsSubmitted = false;

                var producer1 = helper.CreateProducerAsCompany(memberUpload, "AAA");

                database.Model.SaveChanges();

                var dataAccess = new GetProducerComplianceYearDataAccess(database.WeeeContext);

                // Act
                var result = await dataAccess.GetComplianceYears("AAA");

                // Assert
                Assert.Empty(result);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:25,代码来源:GetProducerComplianceYearDataAccessTests.cs

示例11: using

        public async Task MemberUploadSubmissionHandler_SubmitMemberUpload_NewRegisteredProducer_ContainsCorrectValueFor_CurrentSubmission()
        {
            using (var database = new DatabaseWrapper())
            {
                var helper = new ModelHelper(database.Model);

                var scheme = helper.CreateScheme();
                string registrationNumber = "AAAA";
                int complianceYear = 2016;

                var registeredProducer = helper.GetOrCreateRegisteredProducer(scheme, complianceYear, registrationNumber);

                var memberUpload = helper.CreateMemberUpload(scheme);
                memberUpload.ComplianceYear = complianceYear;
                memberUpload.IsSubmitted = false;

                var producerSubmission = helper.CreateProducerAsCompany(memberUpload, registrationNumber);

                // At least one user is required in the database.
                helper.GetOrCreateUser("A user");

                database.Model.SaveChanges();

                User user = await database.WeeeContext.Users.FirstAsync();
                IDomainUserContext domainUserContext = A.Fake<IDomainUserContext>();
                A.CallTo(() => domainUserContext.GetCurrentUserAsync()).Returns(user);

                var handler = new MemberUploadSubmissionHandler(A.Dummy<IWeeeAuthorization>(), database.WeeeContext, domainUserContext);
                await handler.HandleAsync(new MemberUploadSubmission(scheme.OrganisationId, memberUpload.Id));

                var registeredProducerDb = FindRegisteredProducer(database, registeredProducer.Id);

                Assert.Equal(registeredProducerDb.CurrentSubmission.Id, producerSubmission.Id);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:35,代码来源:MemberUploadSubmissionHandlerTests.cs

示例12: Execute_WithNonSubmittedMemberUpload_IgnoresProducer

        public async Task Execute_WithNonSubmittedMemberUpload_IgnoresProducer()
        {
            using (DatabaseWrapper db = new DatabaseWrapper())
            {
                // Arrange
                ModelHelper helper = new ModelHelper(db.Model);

                Scheme scheme1 = helper.CreateScheme();

                MemberUpload memberUpload1 = helper.CreateMemberUpload(scheme1);
                memberUpload1.ComplianceYear = 2016;
                memberUpload1.IsSubmitted = false;

                helper.CreateProducerAsCompany(memberUpload1, "WEE/11AAAA11");

                db.Model.SaveChanges();

                // Act
                List<MembersDetailsCsvData> results = await db.StoredProcedures.SpgCSVDataBySchemeComplianceYearAndAuthorisedAuthority(2016, false, false, scheme1.Id, null);

                // Assert
                Assert.NotNull(results);
                Assert.Equal(0, results.Count);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:25,代码来源:SpgCSVDataBySchemeComplianceYearAndAuthorisedAuthorityTests.cs

示例13: Execute_HappyPath_ReturnsProducerWithSelectedSchemeandAA

        public async Task Execute_HappyPath_ReturnsProducerWithSelectedSchemeandAA()
        {
            using (DatabaseWrapper db = new DatabaseWrapper())
            {
                // Arrange
                ModelHelper helper = new ModelHelper(db.Model);

                Scheme scheme1 = helper.CreateScheme();

                scheme1.CompetentAuthorityId = new Guid("4EEE5942-01B2-4A4D-855A-34DEE1BBBF26");

                MemberUpload memberUpload1 = helper.CreateMemberUpload(scheme1);
                memberUpload1.ComplianceYear = 2016;
                memberUpload1.IsSubmitted = true;
                memberUpload1.SubmittedDate = new DateTime(2015, 1, 1);

                ProducerSubmission producer1 = helper.CreateProducerAsCompany(memberUpload1, "WEE/11AAAA11");

                db.Model.SaveChanges();

                // Act
                List<MembersDetailsCsvData> results =
                    await db.StoredProcedures.SpgCSVDataBySchemeComplianceYearAndAuthorisedAuthority(2016, false,
                        false, scheme1.Id, scheme1.CompetentAuthorityId);

                // Assert
                Assert.NotNull(results);
                Assert.Equal(1, results.Count);

                MembersDetailsCsvData result = results[0];

                Assert.Equal("WEE/11AAAA11", result.PRN);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:34,代码来源:SpgCSVDataBySchemeComplianceYearAndAuthorisedAuthorityTests.cs

示例14: GetComplianceYears_ReturnsComplianceYearForRegisteredProducer

        public async Task GetComplianceYears_ReturnsComplianceYearForRegisteredProducer()
        {
            using (DatabaseWrapper database = new DatabaseWrapper())
            {
                // Arrange
                ModelHelper helper = new ModelHelper(database.Model);

                var scheme = helper.CreateScheme();
                var memberUpload = helper.CreateSubmittedMemberUpload(scheme);
                memberUpload.ComplianceYear = 2016;

                var producer1 = helper.CreateProducerAsCompany(memberUpload, "AAA");

                database.Model.SaveChanges();

                var dataAccess = new GetProducerComplianceYearDataAccess(database.WeeeContext);

                // Act
                var result = await dataAccess.GetComplianceYears("AAA");

                // Assert
                Assert.Single(result);
                Assert.Contains(2016, result);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:25,代码来源:GetProducerComplianceYearDataAccessTests.cs

示例15: SpgProducerEeeDataHistoryCsvTests_ForEachQuarter_ReturnsProducerEeeDataHistoryLatestDataSetToYes

        public async Task SpgProducerEeeDataHistoryCsvTests_ForEachQuarter_ReturnsProducerEeeDataHistoryLatestDataSetToYes()
        {
            using (DatabaseWrapper db = new DatabaseWrapper())
            {
                //Arrange
                ModelHelper helper = new ModelHelper(db.Model);
                var scheme1 = helper.CreateScheme();
                scheme1.ApprovalNumber = "WEE/TE1111ST/SCH";
                var memberUpload1 = helper.CreateSubmittedMemberUpload(scheme1);
                memberUpload1.ComplianceYear = 2000;

                var producer1 = helper.CreateProducerAsCompany(memberUpload1, "PRN345");
                producer1.ObligationType = "B2B";
                var dataReturnVersion1 = helper.CreateDataReturnVersion(scheme1, 2000, 4);
                dataReturnVersion1.SubmittedDate = new DateTime(2015, 1, 8);

                var dataReturnVersion2 = helper.CreateDataReturnVersion(scheme1, 2000, 2);
                dataReturnVersion2.SubmittedDate = new DateTime(2015, 1, 6);

                var dataReturnVersion3 = helper.CreateDataReturnVersion(scheme1, 2000, 3);
                dataReturnVersion3.SubmittedDate = new DateTime(2015, 1, 3);
                var dataReturnVersion4 = helper.CreateDataReturnVersion(scheme1, 2000, 1);
                dataReturnVersion4.SubmittedDate = new DateTime(2015, 1, 1);
                //Latest for quarter 4
                var dataReturnVersion5 = helper.CreateDataReturnVersion(scheme1, 2000, 4);
                dataReturnVersion5.SubmittedDate = new DateTime(2015, 1, 10);

                helper.CreateEeeOutputAmount(dataReturnVersion1, producer1.RegisteredProducer, "B2B", 10, 100);
                helper.CreateEeeOutputAmount(dataReturnVersion2, producer1.RegisteredProducer, "B2B", 11, 200);
                helper.CreateEeeOutputAmount(dataReturnVersion3, producer1.RegisteredProducer, "B2B", 12, 300);
                helper.CreateEeeOutputAmount(dataReturnVersion4, producer1.RegisteredProducer, "B2B", 13, 500);
                helper.CreateEeeOutputAmount(dataReturnVersion5, producer1.RegisteredProducer, "B2B", 13, 600);

                db.Model.SaveChanges();

                // Act
                var results = await db.StoredProcedures.SpgProducerEeeHistoryCsvData("PRN345");

                //Assert
                Assert.NotNull(results);
                Assert.Equal("Yes", results.ProducerReturnsHistoryData[4].LatestData);
                Assert.Equal(600, results.ProducerReturnsHistoryData[4].Cat13B2B);

                Assert.Equal("No", results.ProducerReturnsHistoryData[3].LatestData);
                Assert.Equal(100, results.ProducerReturnsHistoryData[3].Cat10B2B);

                Assert.Equal("Yes", results.ProducerReturnsHistoryData[2].LatestData);
                Assert.Equal(200, results.ProducerReturnsHistoryData[2].Cat11B2B);

                Assert.Equal("Yes", results.ProducerReturnsHistoryData[1].LatestData);
                Assert.Equal(300, results.ProducerReturnsHistoryData[1].Cat12B2B);

                Assert.Equal("Yes", results.ProducerReturnsHistoryData[0].LatestData);
                Assert.Equal(500, results.ProducerReturnsHistoryData[0].Cat13B2B);

                Assert.Equal(5, results.ProducerReturnsHistoryData.Count);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:58,代码来源:SpgProducerEeeDataHistoryCsvTests.cs


注:本文中的ModelHelper.CreateProducerAsCompany方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。