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)"); }
public void GetTypeInformation_WhenCompiledAssembly_EnsuresEnumsWithValuesPresent() { // Arrange string[] expectedEnumValues = new[] { "Type1", "Type2", "Type3" }; // Act IEnumerable <TypeInformation> result = WhenTypeInformationForTheAssemblyIsCreated(GetCalculationsWithEnumsExampleAssembly()); // Assert result.Should().NotBeNull("Result should not be null"); TypeInformation enumTypeInformation = result.FirstOrDefault(t => t.Name == "TypeOfFundingOptions"); enumTypeInformation.Should().NotBeNull(); enumTypeInformation.EnumValues.Should().BeEquivalentTo(expectedEnumValues); enumTypeInformation.Type.Should().Be("DSGCalculations+TypeOfFundingOptions"); }
public void GetTypeInformation_WhenCompiledAssembly_EnsuresBooleanValueReturnMethodsPresent() { // Act IEnumerable <TypeInformation> result = WhenTypeInformationForTheAssemblyIsCreated(GetCalculationsWithEnumsExampleAssembly()); // Assert result.Should().NotBeNull("Result should not be null"); TypeInformation dsgCalcTypeInformation = result.FirstOrDefault(t => t.Name == "DSGCalculations"); dsgCalcTypeInformation.Should().NotBeNull(); MethodInformation booleanValueMethodInfo = dsgCalcTypeInformation.Methods.FirstOrDefault(x => x.Name == "Eligibilty"); booleanValueMethodInfo.Should().NotBeNull(); booleanValueMethodInfo.ReturnType.Should().Be("Nullable(Of System.Boolean)"); booleanValueMethodInfo.ReturnType.Should().Be("Nullable(Of System.Boolean)"); booleanValueMethodInfo.ReturnTypeClass.Should().Be("System.Boolean"); booleanValueMethodInfo.ReturnTypeIsNullable.Should().Be(true); }