public void GetTypeInformation_WhenListDatasetsThenDatasetPropertyDescriptionsShouldBeReturned()
        {
            // Act
            IEnumerable <TypeInformation> result = WhenTypeInformationForTheAssemblyIsCreated(GetCalculationClassWithListDescriptionsExampleAssembly());

            // Assert
            result.Should().NotBeNull("Result should not be null");

            result.Should().ContainSingle(c => c.Name == "Calculations");

            TypeInformation datasetType = result.Where(e => e.Name == "Datasets").FirstOrDefault();

            datasetType.Name.Should().Be("Datasets");
            datasetType.Description.Should().BeNull();
            datasetType.Type.Should().Be("Datasets");

            List <PropertyInformation> properties = new List <PropertyInformation>(datasetType.Properties);

            PropertyInformation firstDataset = properties[0];

            firstDataset.Should().NotBeNull("firstDataset should not be null");
            firstDataset.Name.Should().Be("ABTestDataset240301001");
            firstDataset.FriendlyName.Should().Be("AB Test Dataset 2403-01-001");
            firstDataset.Description.Should().Be("High Needs Student Numbers");

            PropertyInformation secondDataset = properties[1];

            secondDataset.Should().NotBeNull("firstDataset should not be null");
            secondDataset.Name.Should().Be("ABTestDataset24030020011");
            secondDataset.FriendlyName.Should().Be("AB Test Dataset 2403-002-0011");
            secondDataset.Description.Should().Be("High Needs Student Numbers");

            properties.Should().HaveCount(4, "Datasets should contain expected number of properties");
        }
        public void GetTypeInformation_WithListDatasetsReturnsCalculationObjectWithValidProperties()
        {
            // Act
            IEnumerable <TypeInformation> result = WhenTypeInformationForTheAssemblyIsCreated(GetCalculationClassWithListDatasetsExampleAssembly());

            // Assert
            result.Should().NotBeNull("Result should not be null");

            result.Should().ContainSingle(c => c.Name == "Calculations");

            TypeInformation calculationType = result.Where(e => e.Name == "Calculations").FirstOrDefault();

            calculationType.Name.Should().Be("Calculations");
            calculationType.Description.Should().BeNull();
            calculationType.Type.Should().Be("Calculations");

            calculationType.Properties.Should().NotBeNull();

            PropertyInformation datasetsProperty = calculationType.Properties.Where(p => p.Name == "Datasets").SingleOrDefault();

            datasetsProperty.Should().NotBeNull();

            datasetsProperty.Type.Should().Be("Datasets");

            result.Should().ContainSingle(t => t.Name == "Datasets");
            TypeInformation datasetsType = result.Where(t => t.Name == "Datasets").SingleOrDefault();

            datasetsType.Should().NotBeNull();

            PropertyInformation firstPropertyOfDatasets = datasetsType.Properties.First();

            firstPropertyOfDatasets.Type.Should().Be("List(Of DemoTestAPTDatasetSchemaNoRequiredDataset)");
        }
コード例 #3
0
        public void GetTypeInformation_WhenListDatasetsThenPropertyDescriptionShouldBeReturned()
        {
            // Arrange
            ICodeMetadataGeneratorService generator = GetCodeGenerator();

            byte[] assembly = GetCalculationClassWithListDescriptionsExampleAssembly();

            // Act
            IEnumerable <TypeInformation> result = generator.GetTypeInformation(assembly);

            // Assert
            result.Should().NotBeNull("Result should not be null");

            result.Should().ContainSingle(c => c.Name == "Calculations");

            TypeInformation datasetType = result.Where(e => e.Name == "HighNeedsStudentNumbersDataset").FirstOrDefault();

            datasetType.Name.Should().Be("HighNeedsStudentNumbersDataset");
            datasetType.Description.Should().BeNull();
            datasetType.Type.Should().Be("HighNeedsStudentNumbersDataset");

            List <PropertyInformation> properties = new List <PropertyInformation>(datasetType.Properties);

            PropertyInformation ridProperty = properties[0];

            ridProperty.Should().NotBeNull("ridProperty should not be null");
            ridProperty.Name.Should().Be("Rid");
            ridProperty.FriendlyName.Should().Be("Rid");
            ridProperty.Description.Should().Be("Rid is the unique reference from The Store");

            PropertyInformation parentRidProperty = properties[1];

            parentRidProperty.Should().NotBeNull("parentRidProperty should not be null");
            parentRidProperty.Name.Should().Be("ParentRid");
            parentRidProperty.FriendlyName.Should().Be("Parent Rid");
            parentRidProperty.Description.Should().Be("The Rid of the parent provider (from The Store)");

            PropertyInformation highNeedsStudentsProperty = properties[11];

            highNeedsStudentsProperty.Should().NotBeNull("parentRidProperty should not be null");
            highNeedsStudentsProperty.Name.Should().Be("HighNeedsStudents1924");
            highNeedsStudentsProperty.FriendlyName.Should().Be("High Needs Students 19-24");
            highNeedsStudentsProperty.Description.Should().Be("Current year high needs students aged 19-24");

            properties.Should().HaveCount(22, "HighNeedsStudentNumbersDataset should contain expected number of properties");
        }