public void AddJsonFile_ThrowsIfFileDoesNotExistAtPath() { // Arrange var path = Path.Combine(Directory.GetCurrentDirectory(), "file-does-not-exist.ini"); var builder = new ConfigurationBuilder(); // Act and Assert var ex = Assert.Throws <FileNotFoundException>( () => IniConfigurationExtension.AddIniFile(builder, path)); Assert.Equal($"The configuration file '{path}' was not found and is not optional.", ex.Message); }
public void AddIniFile_ThrowsIfFilePathIsNullOrEmpty(string path) { // Arrange var builder = new ConfigurationBuilder(); // Act and Assert var ex = Assert.Throws <ArgumentException>( () => IniConfigurationExtension.AddIniFile(builder, path)); Assert.Equal("path", ex.ParamName); Assert.StartsWith("File path must be a non-empty string.", ex.Message); }