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


C# ModelHelper.CreateDataReturn方法代码示例

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


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

示例1: Get_TwoUploadsForTheSameComplianceYear_OnlyReturnsTheYearOnce

        public async void Get_TwoUploadsForTheSameComplianceYear_OnlyReturnsTheYearOnce()
        {
            using (var database = new DatabaseWrapper())
            {
                const int complianceYear = 2995;

                // Arrange
                var modelHelper = new ModelHelper(database.Model);

                var organisation = modelHelper.CreateOrganisation();
                await database.Model.SaveChangesAsync();

                var scheme = modelHelper.CreateScheme(organisation);
                await database.Model.SaveChangesAsync();

                var firstDataReturn = modelHelper.CreateDataReturn(scheme, complianceYear, (int)QuarterType.Q1);
                await database.Model.SaveChangesAsync();

                var firstDataReturnVersion = modelHelper.CreateDataReturnVersion(scheme, complianceYear, (int)QuarterType.Q1, true, firstDataReturn);
                modelHelper.CreateDataReturnUpload(scheme, firstDataReturnVersion);
                await database.Model.SaveChangesAsync();

                var secondDataReturn = modelHelper.CreateDataReturn(scheme, complianceYear, (int)QuarterType.Q2);
                await database.Model.SaveChangesAsync();

                var secondDataReturnVersion = modelHelper.CreateDataReturnVersion(scheme, complianceYear, (int)QuarterType.Q2, true, secondDataReturn);
                modelHelper.CreateDataReturnUpload(scheme, secondDataReturnVersion);
                await database.Model.SaveChangesAsync();

                // Act
                var dataAccess = new GetDataReturnsActiveComplianceYearsDataAccess(database.WeeeContext);
                var result = await dataAccess.Get();

                // Assert
                Assert.Single(result.Where(y => y == complianceYear));
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:37,代码来源:GetDataReturnsActiveComplianceYearsDataAccessTests.cs

示例2: FetchDataReturnOrDefault_ResultIncludesUnsubmittedDataReturn

        public async Task FetchDataReturnOrDefault_ResultIncludesUnsubmittedDataReturn()
        {
            using (DatabaseWrapper database = new DatabaseWrapper())
            {
                // Arrange
                ModelHelper helper = new ModelHelper(database.Model);
                DomainHelper domainHelper = new DomainHelper(database.WeeeContext);

                var scheme = helper.CreateScheme();
                var dataReturn = helper.CreateDataReturn(scheme, 2016, 1);

                database.Model.SaveChanges();

                var dataAccess = new DataReturnVersionBuilderDataAccess(domainHelper.GetScheme(scheme.Id), new Quarter(2016, QuarterType.Q1), database.WeeeContext);

                // Act
                var result = await dataAccess.FetchDataReturnOrDefault();

                // Assert
                Assert.NotNull(result);
                Assert.Equal(dataReturn.Id, result.Id);
                Assert.Null(dataReturn.CurrentDataReturnVersion);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:24,代码来源:DataReturnVersionBuilderDataAccessTests.cs

示例3: using

        public async void GetComplianceYearsWithSubmittedMemberUploads_SchemeWithTwoSubmittedDataReturnsInDifferentYears_ReturnsBothYears()
        {
            const int firstComplianceYear = 1765;
            const int secondComplianceYear = 1766;
            const int quarter = 4;

            using (var databaseWrapper = new DatabaseWrapper())
            {
                // Arrange
                var modelHelper = new ModelHelper(databaseWrapper.Model);

                var scheme = modelHelper.CreateScheme();
                var firstDataReturn = modelHelper.CreateDataReturn(scheme, firstComplianceYear, quarter);
                var secondDataReturn = modelHelper.CreateDataReturn(scheme, secondComplianceYear, quarter);

                modelHelper.CreateDataReturnVersion(scheme, firstComplianceYear, quarter, true,
                    firstDataReturn);

                modelHelper.CreateDataReturnVersion(scheme, secondComplianceYear, quarter, true,
                    secondDataReturn);

                await databaseWrapper.Model.SaveChangesAsync();

                // Act
                var dataAccess = new SchemeDataAccess(databaseWrapper.WeeeContext);

                var result = await dataAccess.GetComplianceYearsWithSubmittedDataReturns(scheme.Id);

                // Assert
                Assert.Equal(2, result.Count);
                Assert.Contains(firstComplianceYear, result);
                Assert.Contains(secondComplianceYear, result);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:34,代码来源:SchemeDataAccessTests.cs

示例4: GetLatestProducerEeeData_ReturnsSubmittedDataWithEeeValuesOnly

        public async Task GetLatestProducerEeeData_ReturnsSubmittedDataWithEeeValuesOnly()
        {
            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 dataReturn = helper.CreateDataReturn(scheme, 2016, 1);

                var dataReturnVersion = helper.CreateDataReturnVersion(scheme, 2016, 1, isSubmitted: true, dataReturn: dataReturn);

                database.Model.SaveChanges();

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

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

示例5: GetLatestProducerEeeData_ReturnsLatestDataOnly

        public async Task GetLatestProducerEeeData_ReturnsLatestDataOnly()
        {
            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 dataReturn = helper.CreateDataReturn(scheme, 2016, 1);

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

                var dataReturnVersion2 = helper.CreateDataReturnVersion(scheme, 2016, 1, isSubmitted: true, dataReturn: dataReturn);
                var producerEee2 = helper.CreateEeeOutputAmount(dataReturnVersion2, producer.RegisteredProducer, "B2C", 1, 2000);

                database.Model.SaveChanges();

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

                // Assert
                Assert.NotNull(result);
                Assert.Single(result);
                Assert.Equal(2000, result.Single().Tonnage);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:35,代码来源:SchemeEeeDataQuerySetTests.cs


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