public void AsYamlFromFile_FileExists_CorrectConfiguration()
        {
            // Act
            var configuration = new ConfigurationBuilder <Configuration>()
                                .FromFile("Config\\Yaml\\CopyConfig.yaml")
                                .AsYamlFormat()
                                .Build();

            // Assert
            configuration.Should().BeEquivalentTo(ConfigurationTestData.GetExpected());
        }
        public void AsXmlFromResource_FileExists_CorrectConfiguration()
        {
            // Act
            var configuration = new ConfigurationBuilder <Configuration>()
                                .FromResource("ConfigurationBuilder.Tests.Config.Xml.ResourceConfig.xml")
                                .AsXmlFormat()
                                .Build();

            // Assert
            configuration.Should().BeEquivalentTo(ConfigurationTestData.GetExpected());
        }
Esempio n. 3
0
        public void AsJsonFromStringBuild_FileExists_CorrectConfiguration()
        {
            // Act
            var configuration = new ConfigurationBuilder <Configuration>()
                                .FromString("{" +
                                            "\"ApiUrl\": \"https://test.domain.com\", " +
                                            "\"ApiVersion\": \"1.0\", " +
                                            "\"ClientId\": \"api_client\", " +
                                            "\"ClientSecret\": \"zdFpegWRoCac2dPQpPn1\" }")
                                .AsJsonFormat()
                                .Build();

            // Assert
            configuration.Should().BeEquivalentTo(ConfigurationTestData.GetExpected());
        }
        public void Setup_CustomProcessor_ProcessContentByCustomImplementation()
        {
            // Arrange
            var expected = ConfigurationTestData.GetExpected(clientId: "mocked_implementation");

            var processor = Substitute.For <IContentProcessor <Configuration> >();

            processor.ProcessContent(Arg.Any <IContentReader>()).Returns(expected);

            // Act
            var builder = new ConfigurationBuilder <Configuration>()
                          .Setup(x => x.Processor = processor);

            // Assert
            var config = builder.Processor.ProcessContent(Substitute.For <IContentReader>());

            config.Should().BeEquivalentTo(expected);
        }