public void Value_ShouldBe_NotNull_WhenFileExists() { // Arrange var storage = new FileConfigStorage(ConfigFile("Config.json")); // Act var result = storage.Value(); // Assert result.Should().NotBeNull(); }
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(); }
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(); }