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

45 lines
1.3 KiB
C#
Raw Normal View History

namespace UglyToad.PdfPig.Tests
2018-01-09 06:08:58 +08:00
{
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.PdfPig.PdfDocument",
"UglyToad.PdfPig.ParsingOptions",
"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.Letter",
"UglyToad.PdfPig.Content.Page",
"UglyToad.PdfPig.Content.PageSize",
"UglyToad.PdfPig.Content.DocumentInformation"
2018-01-09 06:08:58 +08:00
};
Assert.Equal(expected.OrderBy(x => x), publicTypeNames.OrderBy(x => x));
}
}
}