Exemplo n.º 1
0
        public void DataReturnSchemaValidation_ProducerList_ContainsDuplicateRegistrationNo_ReturnsValidationError()
        {
            var result = new XmlSchemaHelper(schemaFile).ValidateXmlWithSingleResult(@"DataReturns\XmlFiles\v3-ProducerList-DuplicateRegistrationNo.xml");

            Assert.Equal(XmlSeverityType.Error, result.Severity);
            Assert.Contains("uniqueProducerRegistrationNo", result.Message);
        }
Exemplo n.º 2
0
        public void DataReturnSchemaValidation_B2CWEEEFromDistributors_ContainsReturnWithB2BObligationType_ReturnsValidationError()
        {
            var result = new XmlSchemaHelper(schemaFile).ValidateXmlWithSingleResult(@"DataReturns\XmlFiles\v3-B2CWEEEFromDistributors-ReturnWithB2BObligationType.xml");

            Assert.Equal(XmlSeverityType.Error, result.Severity);
            Assert.Equal("The value of the 'http://www.environment-agency.gov.uk/WEEE/XMLSchema/SchemeReturns:ObligationType' element does not equal its fixed value.", result.Message);
        }
Exemplo n.º 3
0
        public void DataReturnSchemaValidation_DeliveredToAE_ContainsDuplicateAEApprovalNo_ReturnsValidationError()
        {
            var result = new XmlSchemaHelper(schemaFile).ValidateXmlWithSingleResult(@"DataReturns\XmlFiles\v3-DeliveredToAE-DuplicateAEApprovalNo.xml");

            Assert.Equal(XmlSeverityType.Error, result.Severity);
            Assert.Contains("uniqueAEApprovalNo", result.Message);
        }
        public void DataReturnSchemaValidation_ProducerList_ContainsDuplicateCategoryObligationType_ReturnsValidationError()
        {
            var result = new XmlSchemaHelper(schemaFile).ValidateXmlWithSingleResult(@"DataReturns\XmlFiles\v3-ProducerList-DuplicateCategoryObligationType.xml");

            Assert.Equal(XmlSeverityType.Error, result.Severity);
            Assert.Contains("uniqueCategoryObligationProducerReturn", result.Message);
        }
Exemplo n.º 5
0
        public void DataReturnSchemaValidation_B2CWEEEFromFinalHolders_ContainsDuplicateCategoryObligationType_ReturnsValidationError()
        {
            var result = new XmlSchemaHelper(schemaFile).ValidateXmlWithSingleResult(@"DataReturns\XmlFiles\v3-B2CWEEEFromFinalHolders-DuplicateCategoryObligationType.xml");

            Assert.Equal(XmlSeverityType.Error, result.Severity);
            Assert.Contains("uniqueCategoryObligationB2CWEEEFromFinalHolders", result.Message);
        }
Exemplo n.º 6
0
        public void DataReturnSchemaValidation_DeliveredToATF_ContainsDuplicateCategoryObligationType_ReturnsValidationError()
        {
            var result = new XmlSchemaHelper(schemaFile).ValidateXmlWithSingleResult(@"DataReturns\XmlFiles\v3-DeliveredToATF-DuplicateCategoryObligationType.xml");

            Assert.Equal(XmlSeverityType.Error, result.Severity);
            Assert.Contains("uniqueCategoryDeliveredToATF", result.Message);
        }
Exemplo n.º 7
0
        public void DataReturnSchemaValidation_TonnageWithMoreThan25Digits_ReturnsValidationError()
        {
            var result = new XmlSchemaHelper(schemaFile).ValidateXmlWithSingleResult(@"DataReturns\XmlFiles\v3-Tonnage-WithMoreThan25Digits.xml");

            Assert.Equal(XmlSeverityType.Error, result.Severity);
            Assert.Contains("TotalDigits constraint failed", result.Message);
        }
Exemplo n.º 8
0
        public void GenerateXml_CreatesValidDataReturnsXmlFile()
        {
            // Arrange
            var scheme = A.Fake <Scheme>();

            A.CallTo(() => scheme.ApprovalNumber)
            .Returns("WEE/SC0001ST/SCH");

            var dataReturn        = new DataReturn(scheme, new Quarter(2016, QuarterType.Q2));
            var dataReturnVersion = new DataReturnVersion(dataReturn);

            // WEEE collected
            dataReturnVersion.WeeeCollectedReturnVersion.AddWeeeCollectedAmount(
                new WeeeCollectedAmount(WeeeCollectedAmountSourceType.Dcf, ObligationType.B2C, WeeeCategory.ElectricalAndElectronicTools, 100));
            dataReturnVersion.WeeeCollectedReturnVersion.AddWeeeCollectedAmount(
                new WeeeCollectedAmount(WeeeCollectedAmountSourceType.Dcf, ObligationType.B2B, WeeeCategory.DisplayEquipment, 200));

            dataReturnVersion.WeeeCollectedReturnVersion.AddWeeeCollectedAmount(
                new WeeeCollectedAmount(WeeeCollectedAmountSourceType.Distributor, ObligationType.B2C, WeeeCategory.ElectricalAndElectronicTools, 100));
            dataReturnVersion.WeeeCollectedReturnVersion.AddWeeeCollectedAmount(
                new WeeeCollectedAmount(WeeeCollectedAmountSourceType.Distributor, ObligationType.B2C, WeeeCategory.ITAndTelecommsEquipment, 50));

            dataReturnVersion.WeeeCollectedReturnVersion.AddWeeeCollectedAmount(
                new WeeeCollectedAmount(WeeeCollectedAmountSourceType.FinalHolder, ObligationType.B2C, WeeeCategory.ElectricalAndElectronicTools, 100));
            dataReturnVersion.WeeeCollectedReturnVersion.AddWeeeCollectedAmount(
                new WeeeCollectedAmount(WeeeCollectedAmountSourceType.FinalHolder, ObligationType.B2C, WeeeCategory.MedicalDevices, 2));

            // WEEE delivered
            var aatfDeliveryLocation1 = new AatfDeliveryLocation("WEE/AA0001AA/ATF", "TestAATF1");

            dataReturnVersion.WeeeDeliveredReturnVersion.AddWeeeDeliveredAmount(
                new WeeeDeliveredAmount(ObligationType.B2C, WeeeCategory.LargeHouseholdAppliances, 200, aatfDeliveryLocation1));
            dataReturnVersion.WeeeDeliveredReturnVersion.AddWeeeDeliveredAmount(
                new WeeeDeliveredAmount(ObligationType.B2C, WeeeCategory.PhotovoltaicPanels, 200, aatfDeliveryLocation1));

            var aatfDeliveryLocation2 = new AatfDeliveryLocation("WEE/AA0002AA/ATF", "TestAATF2");

            dataReturnVersion.WeeeDeliveredReturnVersion.AddWeeeDeliveredAmount(
                new WeeeDeliveredAmount(ObligationType.B2B, WeeeCategory.PhotovoltaicPanels, 200, aatfDeliveryLocation2));

            var aeDeliveryLocation1 = new AeDeliveryLocation("WEE/AA0001AA/AE", "TestAE1");

            dataReturnVersion.WeeeDeliveredReturnVersion.AddWeeeDeliveredAmount(
                new WeeeDeliveredAmount(ObligationType.B2C, WeeeCategory.LargeHouseholdAppliances, 200, aeDeliveryLocation1));
            dataReturnVersion.WeeeDeliveredReturnVersion.AddWeeeDeliveredAmount(
                new WeeeDeliveredAmount(ObligationType.B2B, WeeeCategory.LightingEquipment, 20, aeDeliveryLocation1));

            var aeDeliveryLocation2 = new AeDeliveryLocation("WEE/AA0002AA/AE", "TestAE2");

            dataReturnVersion.WeeeDeliveredReturnVersion.AddWeeeDeliveredAmount(
                new WeeeDeliveredAmount(ObligationType.B2B, WeeeCategory.LightingEquipment, 10, aeDeliveryLocation2));

            // EEE output
            var registeredProducer1 = CreateRegisteredProducer(scheme, 2016, "WEE/AA0001RP", "Test Organisation1");

            dataReturnVersion.EeeOutputReturnVersion.AddEeeOutputAmount(
                new EeeOutputAmount(ObligationType.B2C, WeeeCategory.LightingEquipment, 3000, registeredProducer1));
            dataReturnVersion.EeeOutputReturnVersion.AddEeeOutputAmount(
                new EeeOutputAmount(ObligationType.B2C, WeeeCategory.PhotovoltaicPanels, 100, registeredProducer1));

            var registeredProducer2 = CreateRegisteredProducer(scheme, 2016, "WEE/AA0002RP", "Test Organisation2");

            dataReturnVersion.EeeOutputReturnVersion.AddEeeOutputAmount(
                new EeeOutputAmount(ObligationType.B2C, WeeeCategory.PhotovoltaicPanels, 100, registeredProducer2));

            var xmlGenerator = new XmlGenerator();

            // Act
            var generatedXml = xmlGenerator.GenerateXml(dataReturnVersion);

            // Assert
            var xmlSchemaHelper  = new XmlSchemaHelper(@"DataReturns\v3schema.xsd");
            var validationResult = xmlSchemaHelper.ValidateXml(generatedXml);

            Assert.Empty(validationResult);
        }