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


C# ModelHelper.CreateProducerAsPartnership方法代码示例

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


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

示例1: Execute_ProducerTypeIsPartnership_ReturnsPartnershipNameAsProducerName

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

                Scheme scheme1 = helper.CreateScheme();

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

                scheme1.Organisation.BusinessAddressId = new Guid("b58e9cb2-b97e-4141-ad32-73c70284fc77");
                scheme1.Organisation.Address = helper.CreateOrganisationAddress();
                scheme1.Organisation.Address.Id = new Guid("b58e9cb2-b97e-4141-ad32-73c70284fc77");

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

                ProducerSubmission producerSubmission = helper.CreateProducerAsPartnership(memberUpload1, "WEE/99ZZZZ99");

                db.Model.SaveChanges();

                // Act
                List<ProducerPublicRegisterCSVData> results =
                   await db.StoredProcedures.SpgProducerPublicRegisterCSVDataByComplianceYear(2016);

                // Assert
                var result = results.SingleOrDefault(i => i.PRN == "WEE/99ZZZZ99");

                Assert.NotNull(result);
                Assert.Equal(result.ProducerName, producerSubmission.Business.Partnership.Name);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:35,代码来源:SpgProducerPublicRegisterCSVDataByComplianceYearTests.cs

示例2: Execute_WithProducerBrandNames_ReturnsBrandNamesForRemovedProducer

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

                Scheme scheme = helper.CreateScheme();

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

                ProducerSubmission producer = helper.CreateProducerAsPartnership(memberUpload, "WEE/11BBBB11");
                producer.Business.Partnership.Name = "ABCH";
                producer.RegisteredProducer.Removed = true;

                helper.CreateBrandName(producer, "Brand1");
                helper.CreateBrandName(producer, "Brand2");

                db.Model.SaveChanges();

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

                // Assert
                Assert.NotNull(results);
                Assert.Single(results);

                Assert.NotNull(results[0].BrandNames);
                Assert.Equal("Brand1; Brand2", results[0].BrandNames);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:34,代码来源:SpgCSVDataBySchemeComplianceYearAndAuthorisedAuthorityTests.cs

示例3: Execute_WithProducersInOtherSchemes_ReturnsOtherSchemesProducers

        public async Task Execute_WithProducersInOtherSchemes_ReturnsOtherSchemesProducers()
        {
            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 = true;
                memberUpload1.SubmittedDate = new DateTime(2015, 1, 1);

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

                Scheme scheme2 = helper.CreateScheme();

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

                ProducerSubmission producer2 = helper.CreateProducerAsPartnership(memberUpload2, "WEE/22BBBB22");

                db.Model.SaveChanges();

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

                // Assert
                Assert.NotNull(results);
                Assert.True(results.Any(r => r.PRN == "WEE/11AAAA11"), "Producers from both schemes should be returned when no scheme ID is specified.");
                Assert.True(results.Any(r => r.PRN == "WEE/22BBBB22"), "Producers from both schemes should be returned when no scheme ID is specified.");
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:36,代码来源:SpgCSVDataBySchemeComplianceYearAndAuthorisedAuthorityTests.cs

示例4: Execute_WithSeveralProducersAndIncludeRemovedProducersIsNo_ReturnsAllProducersWithoutRemovedProducers

        public async Task Execute_WithSeveralProducersAndIncludeRemovedProducersIsNo_ReturnsAllProducersWithoutRemovedProducers()
        {
            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 = true;
                memberUpload1.SubmittedDate = new DateTime(2015, 1, 1);

                ProducerSubmission producer1 = helper.CreateProducerAsPartnership(memberUpload1, "WEE/11BBBB11");
                producer1.Business.Partnership.Name = "ABCH";
                producer1.RegisteredProducer.Removed = true;

                ProducerSubmission producer2 = helper.CreateProducerAsCompany(memberUpload1, "WEE/22AAAA22");
                producer2.Business.Company.Name = "AAAA";
                producer2.RegisteredProducer.Removed = true;

                ProducerSubmission producer3 = helper.CreateProducerAsPartnership(memberUpload1, "WEE/33CCCC33");
                producer3.Business.Partnership.Name = "ABCD";
                producer3.RegisteredProducer.Removed = false;

                db.Model.SaveChanges();

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

                // Assert
                Assert.NotNull(results);

                Assert.Equal(1, results.Count);
                Assert.Collection(results,
                   (r1) => Assert.Equal("WEE/33CCCC33", r1.PRN));
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:39,代码来源:SpgCSVDataBySchemeComplianceYearAndAuthorisedAuthorityTests.cs

示例5: Execute_WithOneCurrentInSeveralYearsProducer_ReturnsTheCorrectYearsData

        public async Task Execute_WithOneCurrentInSeveralYearsProducer_ReturnsTheCorrectYearsData()
        {
            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 = true;
                memberUpload1.SubmittedDate = new DateTime(2015, 1, 1);

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

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

                ProducerSubmission producer2 = helper.CreateProducerAsPartnership(memberUpload2, "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(1, results.Count);

                MembersDetailsCsvData result = results[0];

                Assert.Equal(producer1.Business.Partnership.Name, result.ProducerName);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:36,代码来源:SpgCSVDataBySchemeComplianceYearAndAuthorisedAuthorityTests.cs


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