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