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


C# ModelHelper.CreateEeeOutputAmount方法代码示例

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


在下文中一共展示了ModelHelper.CreateEeeOutputAmount方法的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: 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

示例3: 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

示例4: Execute_HappyPath_ReturnsProducerEeeWithSelectedYearAndObligationType

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

                var producer1 = helper.CreateProducerAsCompany(memberUpload, "PRN123");
                var producer2 = helper.CreateProducerAsCompany(memberUpload, "PRN456");

                var dataReturnVersion1 = helper.CreateDataReturnVersion(scheme, 2000, 1);
                var dataReturnVersion2 = helper.CreateDataReturnVersion(scheme, 2000, 2);

                helper.CreateEeeOutputAmount(dataReturnVersion1, producer1.RegisteredProducer, "B2C", 1, 100);
                helper.CreateEeeOutputAmount(dataReturnVersion2, producer1.RegisteredProducer, "B2C", 2, 1000);

                helper.CreateEeeOutputAmount(dataReturnVersion1, producer2.RegisteredProducer, "B2B", 2, 400);

                db.Model.SaveChanges();

                // Act
                var results = await db.StoredProcedures.SpgProducerEeeCsvData(2000, null, "B2C");

                //Assert
                Assert.NotNull(results);

                //Data return with obliation type B2B should not be there in the result.
                ProducerEeeCsvData b2bProducer = results.Find(x => (x.PRN == "PRN456"));
                Assert.Null(b2bProducer);

                ProducerEeeCsvData 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.Cat1Q1);
                Assert.Equal(1000, result.Cat2Q2);
                Assert.Equal(1100, result.TotalTonnage);
                Assert.Null(result.Cat1Q3);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:44,代码来源:SpgProducerEeeCsvDataTests.cs

示例5: Execute_ReturnsEeeData_ForNonRemovedProducersOnly

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

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

                var producer1 = helper.CreateProducerAsCompany(memberUpload, "PRN123");
                producer1.RegisteredProducer.Removed = true;

                var producer2 = helper.CreateProducerAsCompany(memberUpload, "PRN789");

                var dataReturnVersion = helper.CreateDataReturnVersion(scheme, 2000, 1);

                helper.CreateEeeOutputAmount(dataReturnVersion, producer1.RegisteredProducer, "B2C", 1, 100);
                helper.CreateEeeOutputAmount(dataReturnVersion, producer2.RegisteredProducer, "B2C", 1, 200);

                db.Model.SaveChanges();

                // Act
                var results =
                    await db.StoredProcedures.SpgProducerEeeCsvData(2000, null, "B2C");

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

                var data = results.Single();

                Assert.Equal("PRN789", data.PRN);
                Assert.Equal(200, data.Cat1Q1);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:36,代码来源:SpgProducerEeeCsvDataTests.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: SpgProducerEeeDataHistoryCsvTests_EEEDataHistory_DataReturnNotSubmitted_RetunsNoRowsForProducer

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

                var producer1 = helper.CreateProducerAsCompany(memberUpload1, "PRN897");
                producer1.ObligationType = "B2B";

                var dataReturnVersion1 = helper.CreateDataReturnVersion(scheme1, 2000, 1);
                dataReturnVersion1.SubmittedDate = null;
                dataReturnVersion1.DataReturn.Quarter = 4;

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

                db.Model.SaveChanges();

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

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

示例8: using

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

                var producer1 = helper.CreateProducerAsCompany(memberUpload1, "PRN897");
                producer1.ObligationType = "B2B";

                var producer2 = helper.CreateProducerAsCompany(memberUpload1, "PRN123");
                producer2.ObligationType = "B2B";

                EeeOutputAmount eeeOutputAmount1 =
                    helper.CreateEeeOutputAmount(producer1.RegisteredProducer, "B2B", 1, 100);

                EeeOutputAmount eeeOutputAmount2 =
                    helper.CreateEeeOutputAmount(producer2.RegisteredProducer, "B2B", 1, 200);

                // Create a data return version with submission for 2 producers
                var dataReturnVersion1 = helper.CreateDataReturnVersion(scheme1, 2000, 1);
                dataReturnVersion1.SubmittedDate = new DateTime(2015, 1, 1);

                helper.AddEeeOutputAmount(dataReturnVersion1, eeeOutputAmount1);
                helper.AddEeeOutputAmount(dataReturnVersion1, eeeOutputAmount2);

                // Second data return version with producer 1 removed 
                var dataReturnVersion2 = helper.CreateDataReturnVersion(scheme1, 2000, 1);
                dataReturnVersion2.SubmittedDate = new DateTime(2015, 1, 2);

                helper.AddEeeOutputAmount(dataReturnVersion2, eeeOutputAmount2);

                // Third data return version with producer 1 added back again
                var dataReturnVersion3 = helper.CreateDataReturnVersion(scheme1, 2000, 1);
                dataReturnVersion3.SubmittedDate = new DateTime(2015, 1, 3);

                helper.CreateEeeOutputAmount(dataReturnVersion3, producer1.RegisteredProducer, "B2B", 1, 100);

                db.Model.SaveChanges();

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

                //Assert
                Assert.NotNull(results);

                Assert.Equal(2, results.ProducerReturnsHistoryData.Count);

                Assert.Collection(results.ProducerReturnsHistoryData,
                   (r1) => Assert.Equal(new DateTime(2015, 1, 1), r1.SubmittedDate),
                   (r2) => Assert.Equal(new DateTime(2015, 1, 3), r2.SubmittedDate));

                Assert.Equal(1, results.ProducerRemovedFromReturnsData.Count);

                Assert.Collection(results.ProducerRemovedFromReturnsData,
                   (r1) => Assert.Equal(new DateTime(2015, 1, 2), r1.SubmittedDate));

                Assert.Collection(results.ProducerRemovedFromReturnsData,
                  (r1) => Assert.Equal("WEE/TE3334ST/SCH", r1.ApprovalNumber));

                Assert.Collection(results.ProducerRemovedFromReturnsData,
                   (r1) => Assert.Equal(1, r1.Quarter));
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:68,代码来源:SpgProducerEeeDataHistoryCsvTests.cs

示例9: SpgProducerEeeDataHistoryCsvTests_EEEDataHistory_JustOneProducerUploadForTheScheme

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

                var producer1 = helper.CreateProducerAsCompany(memberUpload1, "PRN897");
                producer1.ObligationType = "B2B";

                var dataReturnVersion = helper.CreateDataReturnVersion(scheme1, 2000, 1);
                dataReturnVersion.SubmittedDate = new DateTime(2015, 1, 1);
                dataReturnVersion.DataReturn.Quarter = 4;

                helper.CreateEeeOutputAmount(dataReturnVersion, producer1.RegisteredProducer, "B2B", 1, 100);

                db.Model.SaveChanges();

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

                //Assert
                Assert.NotNull(results);
                Assert.Equal(1, results.ProducerReturnsHistoryData.Count);
                Assert.Equal("PRN897", results.ProducerReturnsHistoryData[0].PRN);
                Assert.Equal("WEE/TE3334ST/SCH", results.ProducerReturnsHistoryData[0].ApprovalNumber);
                Assert.Equal("Yes", results.ProducerReturnsHistoryData[0].LatestData);
                Assert.Equal(4, results.ProducerReturnsHistoryData[0].Quarter);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:34,代码来源:SpgProducerEeeDataHistoryCsvTests.cs

示例10: SpgProducerEeeDataHistoryCsvTests_EEEDataHistory_OmitsDataReturnsNotChanged

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

                var producer1 = helper.CreateProducerAsCompany(memberUpload1, "PRN897");
                producer1.ObligationType = "B2B";

                // Create a submission
                EeeOutputAmount eeeOutputAmount1 =
                    helper.CreateEeeOutputAmount(producer1.RegisteredProducer, "B2B", 1, 100);
                EeeOutputReturnVersion eeeOutputReturnVersion1 = helper.CreateEeeOutputReturnVersion();
                helper.AddEeeOutputAmount(eeeOutputReturnVersion1, eeeOutputAmount1);

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

                dataReturnVersion1.EeeOutputReturnVersion = eeeOutputReturnVersion1;

                // Create two additional submissions, both having the same data
                // but are different from the first
                EeeOutputAmount eeeOutputAmount2 =
                    helper.CreateEeeOutputAmount(producer1.RegisteredProducer, "B2B", 1, 200);
                EeeOutputReturnVersion eeeOutputReturnVersion2 = helper.CreateEeeOutputReturnVersion();
                helper.AddEeeOutputAmount(eeeOutputReturnVersion2, eeeOutputAmount2);

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

                var dataReturnVersion3 = helper.CreateDataReturnVersion(scheme1, 2000, 1);
                dataReturnVersion3.SubmittedDate = new DateTime(2015, 1, 3);

                dataReturnVersion2.EeeOutputReturnVersion = eeeOutputReturnVersion2;
                dataReturnVersion3.EeeOutputReturnVersion = eeeOutputReturnVersion2;

                db.Model.SaveChanges();

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

                //Assert
                Assert.NotNull(results);
                //Only shows entries for tonnage value changes and ignores the ones with no change.
                Assert.Equal(2, results.ProducerReturnsHistoryData.Count);

                Assert.Collection(results.ProducerReturnsHistoryData,
                   (r1) => Assert.Equal(new DateTime(2015, 1, 1), r1.SubmittedDate),
                   (r2) => Assert.Equal(new DateTime(2015, 1, 2), r2.SubmittedDate));

                Assert.Collection(results.ProducerReturnsHistoryData,
                  (r1) => Assert.Equal("No", r1.LatestData),
                  (r2) => Assert.Equal("Yes", r2.LatestData));
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:60,代码来源:SpgProducerEeeDataHistoryCsvTests.cs

示例11: Execute_ReturnsPreviousYearDataFromOldScheme_WhenProducerRegisteredWithNewScheme

        public async Task Execute_ReturnsPreviousYearDataFromOldScheme_WhenProducerRegisteredWithNewScheme()
        {
            using (DatabaseWrapper 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
                var memberUpload2000s1 = helper.CreateSubmittedMemberUpload(scheme1);
                memberUpload2000s1.ComplianceYear = 2000;
                var prod1_2000s1 = helper.CreateProducerAsCompany(memberUpload2000s1, "PRN123", "B2C");
                var dataReturnVersion1 = helper.CreateDataReturnVersion(scheme1, 2000, 1);
                helper.CreateEeeOutputAmount(dataReturnVersion1, prod1_2000s1.RegisteredProducer, "B2C", 1, 500);

                //Current Year Data
                var memberUpload2001s2 = helper.CreateSubmittedMemberUpload(scheme2);
                memberUpload2001s2.ComplianceYear = 2001;
                var prod1_2001s2 = helper.CreateProducerAsCompany(memberUpload2001s2, "PRN123", "B2C");
                var dataReturnVersion2 = helper.CreateDataReturnVersion(scheme2, 2001, 1);
                helper.CreateEeeOutputAmount(dataReturnVersion2, prod1_2001s2.RegisteredProducer, "B2C", 1, 5000);

                db.Model.SaveChanges();

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

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

示例12: SpgProducerEeeDataHistoryCsvTests_EEEDataHistory_ReturnsOneRowForChangedDataEvenIfOneCategoryChanged

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

                var producer1 = helper.CreateProducerAsCompany(memberUpload1, "PRN897");
                producer1.ObligationType = "B2B";

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

                EeeOutputAmount eeeOutputAmount = helper.CreateEeeOutputAmount(producer1.RegisteredProducer, "B2B", 2, 200);

                helper.AddEeeOutputAmount(dataReturnVersion1, eeeOutputAmount);
                helper.CreateEeeOutputAmount(dataReturnVersion1, producer1.RegisteredProducer, "B2B", 1, 100);

                // Second upload with only category 1 changed, category 2 remains unchanged
                var dataReturnVersion2 = helper.CreateDataReturnVersion(scheme1, 2000, 1);
                dataReturnVersion2.SubmittedDate = new DateTime(2015, 1, 2);

                helper.AddEeeOutputAmount(dataReturnVersion2, eeeOutputAmount);
                helper.CreateEeeOutputAmount(dataReturnVersion2, producer1.RegisteredProducer, "B2B", 1, 300);

                db.Model.SaveChanges();

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

                // Assert
                Assert.NotNull(results);
                // Only shows entries for tonnage value changes and ignores the ones with no change.
                Assert.Equal(2, results.ProducerReturnsHistoryData.Count);

                Assert.Collection(results.ProducerReturnsHistoryData,
                   (r1) => Assert.Equal(new DateTime(2015, 1, 1), r1.SubmittedDate),
                   (r2) => Assert.Equal(new DateTime(2015, 1, 2), r2.SubmittedDate));

                Assert.Collection(results.ProducerReturnsHistoryData,
                  (r1) => Assert.Equal("No", r1.LatestData),
                  (r2) => Assert.Equal("Yes", r2.LatestData));

                Assert.Collection(results.ProducerReturnsHistoryData,
                  (r1) => Assert.Equal(100, r1.Cat1B2B),
                  (r2) => Assert.Equal(300, r2.Cat1B2B));

                Assert.Collection(results.ProducerReturnsHistoryData,
                  (r1) => Assert.Equal(200, r1.Cat2B2B),
                  (r2) => Assert.Equal(200, r2.Cat2B2B));
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:56,代码来源:SpgProducerEeeDataHistoryCsvTests.cs

示例13: Execute_DoesNotReturnCurrentYearB2BProducers_WhenTheyWerePreviousYearB2B

        public async Task Execute_DoesNotReturnCurrentYearB2BProducers_WhenTheyWerePreviousYearB2B()
        {
            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", "B2B");
                var dataReturnVersion1 = helper.CreateDataReturnVersion(scheme, 2000, 1);
                helper.CreateEeeOutputAmount(dataReturnVersion1, prod1_2000.RegisteredProducer, "B2B", 1, 100);

                //Current Year Data
                var memberUpload2001 = helper.CreateSubmittedMemberUpload(scheme);
                memberUpload2001.ComplianceYear = 2001;
                var prod1_2001 = helper.CreateProducerAsCompany(memberUpload2001, "PRN123", "B2B");
                var dataReturnVersion2 = helper.CreateDataReturnVersion(scheme, 2001, 1);
                helper.CreateEeeOutputAmount(dataReturnVersion2, prod1_2001.RegisteredProducer, "B2B", 1, 5000);

                db.Model.SaveChanges();

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

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

示例14: 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

示例15: Execute_ReturnsCurrentYearProducers_WhenNoPreviousYearDataReturnUpload_WithoutEeeData

        public async Task Execute_ReturnsCurrentYearProducers_WhenNoPreviousYearDataReturnUpload_WithoutEeeData()
        {
            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;
                helper.CreateProducerAsCompany(memberUpload2000, "PRN123", "B2C");

                //Current Year Data
                var memberUpload2001 = helper.CreateSubmittedMemberUpload(scheme);
                memberUpload2001.ComplianceYear = 2001;
                var prod1_2001 = helper.CreateProducerAsCompany(memberUpload2001, "PRN123", "Both");
                var dataReturnVersion2 = helper.CreateDataReturnVersion(scheme, 2001, 1);
                helper.CreateEeeOutputAmount(dataReturnVersion2, prod1_2001.RegisteredProducer, "B2C", 1, 3000);
                helper.CreateEeeOutputAmount(dataReturnVersion2, prod1_2001.RegisteredProducer, "B2B", 1, 5000);

                db.Model.SaveChanges();

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

                //Assert
                Assert.NotNull(results);
                Assert.Equal(1, results.Count);
                SchemeObligationCsvData result = results[0];
                Assert.Equal("PRN123", result.PRN);
                Assert.Equal("B2C", result.ObligationTypeForPreviousYear);
                Assert.Equal("Both", result.ObligationTypeForSelectedYear);
                Assert.Null(result.Cat1B2CTotal);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:37,代码来源:SpgSchemeObligationCsvDataTests.cs


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