PdfPig/src/UglyToad.PdfPig.Tests/PublicApiScannerTests.cs

82 lines
3.4 KiB
C#
Raw Normal View History

namespace UglyToad.PdfPig.Tests
2018-01-09 06:08:58 +08:00
{
using System.Collections.Generic;
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.PdfPig.IndirectReference",
"UglyToad.PdfPig.PdfDocument",
"UglyToad.PdfPig.ParsingOptions",
"UglyToad.PdfPig.Structure",
2018-12-22 23:54:32 +08:00
"UglyToad.PdfPig.Annotations.Annotation",
"UglyToad.PdfPig.Annotations.AnnotationType",
"UglyToad.PdfPig.Annotations.AnnotationBorder",
"UglyToad.PdfPig.Annotations.AnnotationFlags",
"UglyToad.PdfPig.Logging.ILog",
"UglyToad.PdfPig.Geometry.PdfPoint",
2018-03-31 06:16:54 +08:00
"UglyToad.PdfPig.Geometry.PdfRectangle",
"UglyToad.PdfPig.Fonts.Exceptions.InvalidFontFormatException",
"UglyToad.PdfPig.Exceptions.PdfDocumentFormatException",
"UglyToad.PdfPig.Content.Catalog",
"UglyToad.PdfPig.Content.DocumentInformation",
"UglyToad.PdfPig.Content.Letter",
"UglyToad.PdfPig.Content.Page",
"UglyToad.PdfPig.Content.PageSize",
"UglyToad.PdfPig.Content.Word",
"UglyToad.PdfPig.CrossReference.CrossReferenceTable",
"UglyToad.PdfPig.CrossReference.CrossReferenceType",
"UglyToad.PdfPig.CrossReference.TrailerDictionary",
"UglyToad.PdfPig.Fonts.DescriptorFontFile",
"UglyToad.PdfPig.Fonts.FontDescriptor",
"UglyToad.PdfPig.Fonts.FontDescriptorFlags",
"UglyToad.PdfPig.Fonts.FontStretch",
"UglyToad.PdfPig.Fonts.Standard14Font",
"UglyToad.PdfPig.Tokens.ArrayToken",
"UglyToad.PdfPig.Tokens.BooleanToken",
"UglyToad.PdfPig.Tokens.CommentToken",
"UglyToad.PdfPig.Tokens.DictionaryToken",
"UglyToad.PdfPig.Tokens.HexToken",
"UglyToad.PdfPig.Tokens.IDataToken`1",
"UglyToad.PdfPig.Tokens.IndirectReferenceToken",
"UglyToad.PdfPig.Tokens.IToken",
"UglyToad.PdfPig.Tokens.NameToken",
"UglyToad.PdfPig.Tokens.NullToken",
"UglyToad.PdfPig.Tokens.NumericToken",
"UglyToad.PdfPig.Tokens.ObjectToken",
"UglyToad.PdfPig.Tokens.StreamToken",
"UglyToad.PdfPig.Tokens.StringToken",
"UglyToad.PdfPig.Util.IWordExtractor",
"UglyToad.PdfPig.Writer.PdfDocumentBuilder",
"UglyToad.PdfPig.Writer.PdfPageBuilder",
"UglyToad.PdfPig.Writer.TokenWriter",
"UglyToad.PdfPig.XObjects.XObjectImage"
2018-01-09 06:08:58 +08:00
};
foreach (var publicTypeName in publicTypeNames)
{
Assert.True(expected.Contains(publicTypeName), $"Type should not be public: {publicTypeName}.");
}
2018-01-09 06:08:58 +08:00
}
}
}