public void IncludeXmlCommentsIfExists_NullAssembly_ThrowsArgumentNullException() => Assert.Throws <ArgumentNullException>(() => { SwaggerGenOptionsExtensions.IncludeXmlCommentsIfExists( new SwaggerGenOptions(), (Assembly)null); });
public void IncludeXmlCommentsIfExists_NullOptions_ThrowsArgumentNullException() => Assert.Throws <ArgumentNullException>(() => { SwaggerGenOptionsExtensions.IncludeXmlCommentsIfExists( null, typeof(SwaggerGenOptionsExtensionsTest).GetTypeInfo().Assembly); });
public void IncludeXmlCommentsIfExists_XmlFileExistsWithAssemblyCodeBase_XmlCommentsFileAdded() { var assembly = typeof(SwaggerGenOptionsExtensionsTest).GetTypeInfo().Assembly; var xmlFilePath = Path.ChangeExtension(new Uri(assembly.CodeBase).AbsolutePath, ".xml"); File.WriteAllText(xmlFilePath, "<?xml version=\"1.0\"?><doc></doc>"); var options = new SwaggerGenOptions(); try { var actualOptions = SwaggerGenOptionsExtensions.IncludeXmlCommentsIfExists( options, assembly); Assert.Same(options, actualOptions); } finally { EnsureFileDeleted(xmlFilePath); } }