Пример #1
0
        public void ReadContentWithEnvironment_NotExistingFile_ThrowsFileNotFoundException()
        {
            // Arrange
            var reader = new ReaderFixture().CreateFileReader("Config\\Json\\CopyConfig.json");

            // Act
            Action action = () => reader.ReadContent("test");

            // assert
            action.Should().Throw <FileNotFoundException>();
        }
Пример #2
0
        public void ReadContentWithEnvironment_ExistingFile_NotEmptyResult()
        {
            // Arrange
            var reader = new ReaderFixture().CreateFileReader("Config\\Json\\CopyConfig.json");

            // Act
            var content = reader.ReadContent("dev");

            // assert
            content.Should().NotBeEmpty();
        }
Пример #3
0
        public void ReadContent_ExistingFile_NotEmptyResult()
        {
            // Arrange
            var reader = new ReaderFixture().CreateEmbeddedResourceReader("Config.Json.ResourceConfig.json");

            // Act
            var content = reader.ReadContent();

            // assert
            content.Should().NotBeEmpty();
        }
Пример #4
0
        public void ReadContentWithEnvironment_NotExistingFile_ThrowsArgumentException()
        {
            // Arrange
            var reader = new ReaderFixture().CreateEmbeddedResourceReader("Config.Json.ResourceConfig.json");

            // Act
            Action action = () => reader.ReadContent("test");

            // assert
            action.Should().Throw <ArgumentException>();
        }
Пример #5
0
        public void ProcessContentForEnvironment_ExistingFiles_LastFileOverrides()
        {
            // Arrange
            var reader        = new ReaderFixture().CreateEmbeddedResourceReader("Config.Json.ResourceConfig.json");
            var jsonProcessor = new JsonProcessor <Configuration>();

            // Act
            var merged = jsonProcessor.ProcessContentForEnvironment(reader, "dev");

            // Assert
            merged.ClientId.Should().Be("api_client_dev");
            merged.ClientSecret.Should().Be("client_secret_dev");
        }