mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-08-20 06:38:07 +08:00
fix test case due to field renaming
This commit is contained in:
parent
00ca268092
commit
5abdfcb96c
@ -68,12 +68,20 @@
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void ReflectionGraphicsStateOperationFactoryKnowsAllOperations()
|
public void ReflectionGraphicsStateOperationFactoryKnowsAllOperations()
|
||||||
{
|
{
|
||||||
var operationsField = typeof(ReflectionGraphicsStateOperationFactory).GetField("operations", BindingFlags.NonPublic | BindingFlags.Static);
|
var operationsField = typeof(ReflectionGraphicsStateOperationFactory)
|
||||||
var operationDictionary = operationsField.GetValue(null) as IReadOnlyDictionary<string, Type>;
|
.GetField("Operations", BindingFlags.NonPublic | BindingFlags.Static);
|
||||||
Assert.NotNull(operationDictionary);
|
|
||||||
|
Assert.NotNull(operationsField);
|
||||||
|
|
||||||
|
var operationDictionaryRaw = operationsField.GetValue(null) as IReadOnlyDictionary<string, Type>;
|
||||||
|
|
||||||
|
Assert.NotNull(operationDictionaryRaw);
|
||||||
|
|
||||||
|
var operationDictionary = new Dictionary<string, Type>(operationDictionaryRaw!.ToDictionary(x => x.Key, x => x.Value));
|
||||||
|
|
||||||
var allOperations = GetOperationTypes();
|
var allOperations = GetOperationTypes();
|
||||||
Assert.Equal(allOperations.Count(), operationDictionary.Count);
|
|
||||||
|
Assert.Equal(allOperations.Count, operationDictionary.Count);
|
||||||
|
|
||||||
var mapped = allOperations.Select(o =>
|
var mapped = allOperations.Select(o =>
|
||||||
{
|
{
|
||||||
@ -84,14 +92,14 @@
|
|||||||
Assert.Equivalent(operationDictionary, mapped, strict: true);
|
Assert.Equivalent(operationDictionary, mapped, strict: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<Type> GetOperationTypes()
|
private static IReadOnlyList<Type> GetOperationTypes()
|
||||||
{
|
{
|
||||||
var assembly = Assembly.GetAssembly(typeof(IGraphicsStateOperation));
|
var assembly = Assembly.GetAssembly(typeof(IGraphicsStateOperation));
|
||||||
|
|
||||||
var operationTypes = assembly.GetTypes().Where(x => typeof(IGraphicsStateOperation).IsAssignableFrom(x)
|
var operationTypes = assembly.GetTypes().Where(x => typeof(IGraphicsStateOperation).IsAssignableFrom(x)
|
||||||
&& !x.IsInterface);
|
&& !x.IsInterface);
|
||||||
|
|
||||||
return operationTypes;
|
return operationTypes.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static object[] GetConstructorParameters(ParameterInfo[] parameters)
|
private static object[] GetConstructorParameters(ParameterInfo[] parameters)
|
||||||
|
Loading…
Reference in New Issue
Block a user