Exemple #1
0
        public void Value_ShouldBe_NotNull_WhenFileExists()
        {
            // Arrange
            var storage = new FileConfigStorage(ConfigFile("Config.json"));
            // Act
            var result = storage.Value();

            // Assert
            result.Should().NotBeNull();
        }
Exemple #2
0
        public void Value_ShouldThrow_FileAccessException_WhenFolderDoesNotExist()
        {
            // Arrange
            var storage = new FileConfigStorage(ConfigFile("Does-not-exist\\Config.json"));
            // Act
            Action action = () => storage.Value();

            // Assert
            action.Should().Throw <Exception>()
            .And.IsFileAccessException().Should().BeTrue();
        }
Exemple #3
0
        public void Save_ShouldSave_ToFile()
        {
            // Arrange
            const string filename = "Saved-app-config.json";
            var          storage  = new FileConfigStorage(ConfigFile(filename));
            var          config   = new DefaultConfig().Value();

            // Act
            storage.Save(config);
            // Assert
            File.Exists($"TestData\\{filename}").Should().BeTrue();
        }