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


C# ModelHelper.CreateScheme方法代码示例

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


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

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

                var scheme1 = helper.CreateScheme();
                var dataReturnVersion = helper.CreateDataReturnVersion(scheme1, 2016, 1, true);

                var scheme2 = helper.CreateScheme();
                helper.CreateDataReturnVersion(scheme2, 2016, 1, true);

                database.Model.SaveChanges();

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

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

                // Assert
                Assert.Equal(scheme1.Id, result.Scheme.Id);
                Assert.Equal(dataReturnVersion.DataReturn.Id, result.Id);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:26,代码来源:DataReturnVersionBuilderDataAccessTests.cs

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

示例4: FetchSumissions_ForYearandScheme_ReturnsSubmittedSubmissions

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

                // Arrange
                Scheme scheme1 = helper.CreateScheme();
                Scheme scheme2 = helper.CreateScheme();

                var user1 = helper.CreateUser("[email protected]");
                var user2 = helper.CreateUser("[email protected]");

                MemberUpload memberUpload1 = helper.CreateMemberUpload(scheme1);
                memberUpload1.ComplianceYear = 2005;
                memberUpload1.IsSubmitted = true;
                memberUpload1.SubmittedDate = new DateTime(2015, 09, 22, 10, 45, 45);
                memberUpload1.SubmittedByUserId = user1.Id;

                MemberUpload memberUpload2 = helper.CreateMemberUpload(scheme1);
                memberUpload2.ComplianceYear = 2006;
                memberUpload2.IsSubmitted = true;
                memberUpload2.SubmittedDate = new DateTime(2015, 08, 10, 12, 25, 35);
                memberUpload2.SubmittedByUserId = user1.Id;

                MemberUpload memberUpload3 = helper.CreateMemberUpload(scheme1);
                memberUpload3.ComplianceYear = 2006;
                memberUpload3.IsSubmitted = false;
                memberUpload3.SubmittedDate = new DateTime(2015, 09, 10, 12, 25, 35);
                memberUpload3.SubmittedByUserId = user1.Id;

                MemberUpload memberUpload4 = helper.CreateMemberUpload(scheme2);
                memberUpload4.ComplianceYear = 2006;
                memberUpload4.IsSubmitted = true;
                memberUpload4.SubmittedDate = new DateTime(2015, 07, 22, 10, 45, 45);
                memberUpload4.SubmittedByUserId = user2.Id;

                database.Model.SaveChanges();

                // Act
                GetSubmissionsHistoryResultsDataAccess dataAccess =
                    new GetSubmissionsHistoryResultsDataAccess(database.WeeeContext);
                var results = await dataAccess.GetSubmissionsHistory(scheme1.Id, 2006);

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

                var result1 = results.Data.SingleOrDefault(r => r.Year == 2006);
                Assert.NotNull(result1);
                Assert.Equal("08/10/2015 12:25:35", result1.DateTime.ToString(CultureInfo.InvariantCulture));
                Assert.Equal("Test LastName", result1.SubmittedBy);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:54,代码来源:GetSubmissionsHistoryResultsDataAccessTests.cs

示例5: FetchSumissions_ForYearandScheme_ReturnsSubmittedSubmissionsWithCorrectnumberOfWarnings

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

                // Arrange
                Scheme scheme1 = helper.CreateScheme();
                Scheme scheme2 = helper.CreateScheme();

                var user1 = helper.CreateUser("[email protected]");
                var user2 = helper.CreateUser("[email protected]");

                MemberUpload memberUpload1 = helper.CreateMemberUpload(scheme1);
                memberUpload1.ComplianceYear = 2006;
                memberUpload1.IsSubmitted = true;
                memberUpload1.SubmittedDate = new DateTime(2015, 09, 23, 10, 45, 45);
                memberUpload1.SubmittedByUserId = user1.Id;

                MemberUpload memberUpload2 = helper.CreateMemberUpload(scheme1);
                memberUpload2.ComplianceYear = 2006;
                memberUpload2.IsSubmitted = true;
                memberUpload2.SubmittedDate = new DateTime(2015, 08, 4, 12, 24, 35);
                memberUpload2.SubmittedByUserId = user1.Id;

                MemberUpload memberUpload3 = helper.CreateMemberUpload(scheme1);
                memberUpload3.ComplianceYear = 2006;
                memberUpload3.IsSubmitted = false;
                memberUpload3.SubmittedDate = new DateTime(2015, 08, 10, 12, 25, 32);
                memberUpload3.SubmittedByUserId = user1.Id;

                MemberUpload memberUpload4 = helper.CreateMemberUpload(scheme2);
                memberUpload4.ComplianceYear = 2006;
                memberUpload4.IsSubmitted = true;
                memberUpload4.SubmittedDate = new DateTime(2015, 07, 31, 10, 25, 45);
                memberUpload4.SubmittedByUserId = user2.Id;

                helper.CreateMemberUploadError(memberUpload2);
                helper.CreateMemberUploadError(memberUpload2);

                database.Model.SaveChanges();

                // Act
                GetSubmissionsHistoryResultsDataAccess dataAccess = new GetSubmissionsHistoryResultsDataAccess(database.WeeeContext);
                var results = await dataAccess.GetSubmissionsHistory(scheme1.Id, 2006);

                // Assert
                Assert.NotNull(results.Data);
                Assert.Equal(2, results.Data.Count);
                Assert.Collection(results.Data,
                    r1 => Assert.Equal(0, r1.NoOfWarnings),
                    r2 => Assert.Equal(2, r2.NoOfWarnings));
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:54,代码来源:GetSubmissionsHistoryResultsDataAccessTests.cs

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

示例7: using

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

                var scheme = modelHelper.CreateScheme();

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

                modelHelper.CreateProducerAsCompany(memberUpload, "1111", "B2B");

                var scheme2 = modelHelper.CreateScheme();

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

                modelHelper.CreateProducerAsCompany(memberUpload2, "1111", "B2C");

                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,代码行数:33,代码来源:SpgSubmissionChangesCsvDataTests.cs

示例8: GetPreviousSubmission_ReturnsPreviousSubmissionForSameSchemeOnly

        public async Task GetPreviousSubmission_ReturnsPreviousSubmissionForSameSchemeOnly()
        {
            using (var database = new DatabaseWrapper())
            {
                // Arrange
                DataReturnSubmissionsDataAccess dataAccess = new DataReturnSubmissionsDataAccess(database.WeeeContext);

                ModelHelper modelHelper = new ModelHelper(database.Model);
                DomainHelper domainHelper = new DomainHelper(database.WeeeContext);

                var scheme1 = modelHelper.CreateScheme();

                var dataReturnVersion = modelHelper.CreateDataReturnVersion(scheme1, 2015, 1, true);
                dataReturnVersion.SubmittedDate = new DateTime(2015, 1, 1);

                var dataReturnVersion2 = modelHelper.CreateDataReturnVersion(scheme1, 2015, 1, true);
                dataReturnVersion2.SubmittedDate = new DateTime(2015, 3, 1);

                var scheme2 = modelHelper.CreateScheme();

                var dataReturnVersion3 = modelHelper.CreateDataReturnVersion(scheme2, 2015, 1, true);
                dataReturnVersion3.SubmittedDate = new DateTime(2015, 2, 1);

                database.Model.SaveChanges();

                var domainDataReturnVersion = domainHelper.GetDataReturnVersion(dataReturnVersion2.Id);

                // Act
                var result = await dataAccess.GetPreviousSubmission(domainDataReturnVersion);

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

示例9: GetPreviousSubmission_ReturnsNullIfPreviousUploadButNoSubmission

        public async Task GetPreviousSubmission_ReturnsNullIfPreviousUploadButNoSubmission()
        {
            using (var database = new DatabaseWrapper())
            {
                // Arrange
                DataReturnSubmissionsDataAccess dataAccess = new DataReturnSubmissionsDataAccess(database.WeeeContext);

                ModelHelper modelHelper = new ModelHelper(database.Model);
                DomainHelper domainHelper = new DomainHelper(database.WeeeContext);

                var scheme = modelHelper.CreateScheme();

                var dataReturnVersion = modelHelper.CreateDataReturnVersion(scheme, 2015, 1, false);

                var dataReturnVersion2 = modelHelper.CreateDataReturnVersion(scheme, 2015, 1, true);
                dataReturnVersion2.SubmittedDate = new DateTime(2015, 2, 1);

                database.Model.SaveChanges();

                var domainDataReturnVersion = domainHelper.GetDataReturnVersion(dataReturnVersion2.Id);

                // Act
                var result = await dataAccess.GetPreviousSubmission(domainDataReturnVersion);

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

示例10: FetchSchemeInfo_WithValidOrganisationId_ReturnsScheme

        public async void FetchSchemeInfo_WithValidOrganisationId_ReturnsScheme()
        {
            using (var database = new DatabaseWrapper())
            {
                // Arrange
                Guid organisationId = Guid.NewGuid();
                ModelHelper modelHelper = new ModelHelper(database.Model);

                var scheme = modelHelper.CreateScheme();
                scheme.ApprovalNumber = "1234";
                scheme.Organisation.Id = organisationId;
                scheme.Organisation.TradingName = "TradingName";

                database.Model.SaveChanges();

                ProducerListFactoryDataAccess dataAccess = new ProducerListFactoryDataAccess(database.WeeeContext);

                // Act
                var result = await dataAccess.FetchSchemeInfo(organisationId);

                // Assert
                Assert.Equal("1234", result.First().ApprovalNumber);
                Assert.Equal("TradingName", result.First().TradingName);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:25,代码来源:ProducerListFactoryDataAccessTests.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: 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

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

示例14: GetLatestProducerEeeData_ReturnsData_WhenDataAvailableForSpecifiedScheme

        public async Task GetLatestProducerEeeData_ReturnsData_WhenDataAvailableForSpecifiedScheme()
        {
            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/MM0001AA");

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

示例15: Submit_SetsDataReturnVersionAsSubmitted

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

                var scheme = helper.CreateScheme();
                var dataReturnVersion = helper.CreateDataReturnVersion(scheme, 2016, 1, false);

                database.Model.SaveChanges();

                var dbDataReturnVersion = domainHelper.GetDataReturnVersion(dataReturnVersion.Id);
                var dataAccess = new SubmitReturnVersionDataAccess(database.WeeeContext);

                // Act
                await dataAccess.Submit(dbDataReturnVersion);

                // Assert
                Assert.Equal(dataReturnVersion.Id, dbDataReturnVersion.Id);
                Assert.True(dbDataReturnVersion.IsSubmitted);
                Assert.NotNull(dbDataReturnVersion.SubmittedDate);
                Assert.Equal(database.WeeeContext.GetCurrentUser(), dbDataReturnVersion.SubmittingUserId);
                Assert.Equal(dataReturnVersion.Id, dbDataReturnVersion.DataReturn.CurrentVersion.Id);
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:27,代码来源:SubmitReturnVersionDataAccessTests.cs


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