check public api through reflection

This commit is contained in:
Eliot Jones
2018-01-08 22:08:58 +00:00
parent b1fbcd0ccd
commit bf7d3868da
4 changed files with 51 additions and 6 deletions

View File

@@ -0,0 +1,43 @@
namespace UglyToad.Pdf.Tests
{
using System.Collections.Generic;
using System.Linq;
using Xunit;
public class PublicApiScannerTests
{
[Fact]
public void OnlyExposedApiIsPublic()
{
var assembly = typeof(PdfDocument).Assembly;
var types = assembly.GetTypes();
var publicTypeNames = new List<string>();
foreach (var type in types)
{
if (type.IsPublic)
{
publicTypeNames.Add(type.FullName);
}
}
var expected = new List<string>
{
"UglyToad.Pdf.PdfDocument",
"UglyToad.Pdf.ParsingOptions",
"UglyToad.Pdf.Logging.ILog",
"UglyToad.Pdf.Geometry.PdfPoint",
"UglyToad.Pdf.Fonts.Exceptions.InvalidFontFormatException",
"UglyToad.Pdf.Exceptions.PdfDocumentFormatException",
"UglyToad.Pdf.Content.Letter",
"UglyToad.Pdf.Content.Page",
"UglyToad.Pdf.Content.PageSize",
"UglyToad.Pdf.Content.DocumentInformation"
};
Assert.Equal(expected.OrderBy(x => x), publicTypeNames.OrderBy(x => x));
}
}
}

View File

@@ -0,0 +1,7 @@
namespace UglyToad.Pdf.Filters
{
internal interface IPngPredictor
{
byte[] Decode(byte[] input, int predictor, int colors, int bitsPerComponent, int columns);
}
}

View File

@@ -231,9 +231,4 @@
return (by & mask) | (truncatedVal << startBit);
}
}
public interface IPngPredictor
{
byte[] Decode(byte[] input, int predictor, int colors, int bitsPerComponent, int columns);
}
}

View File

@@ -7,7 +7,7 @@
*
* @author John Hewson
*/
public class Hex
internal class Hex
{
/**
* for hex conversion.