Fix typo in ReflectionUtilities

This commit is contained in:
Stephan
2018-11-18 11:05:14 +01:00
parent 752ae16c1b
commit 5b39e5e5c7
4 changed files with 11 additions and 11 deletions

View File

@@ -112,7 +112,7 @@ namespace Umbraco.Core.Models.PublishedContent
if (ctor != null) return ctor();
var listType = typeof(List<>).MakeGenericType(modelInfo.ModelType);
ctor = modelInfo.ListCtor = ReflectionUtilities.EmitConstuctor<Func<IList>>(declaring: listType);
ctor = modelInfo.ListCtor = ReflectionUtilities.EmitConstructor<Func<IList>>(declaring: listType);
return ctor();
}

View File

@@ -295,7 +295,7 @@ namespace Umbraco.Core
/// <exception cref="InvalidOperationException">Occurs when the constructor does not exist and <paramref name="mustExist"/> is <c>true</c>.</exception>
/// <exception cref="ArgumentException">Occurs when <typeparamref name="TLambda"/> is not a Func or when <paramref name="declaring"/>
/// is specified and does not match the function's returned type.</exception>
public static TLambda EmitConstuctor<TLambda>(bool mustExist = true, Type declaring = null)
public static TLambda EmitConstructor<TLambda>(bool mustExist = true, Type declaring = null)
{
var (_, lambdaParameters, lambdaReturned) = AnalyzeLambda<TLambda>(true, true);

View File

@@ -25,7 +25,7 @@ namespace Umbraco.Tests.Benchmarks
// see benchmarkdotnet FAQ
Add(Job.Default
.WithLaunchCount(1) // benchmark process will be launched only once
.WithIterationTime(TimeInterval.FromMilliseconds(400))
.WithIterationTime(TimeInterval.FromMilliseconds(400))
.WithWarmupCount(3)
.WithTargetCount(6));
}
@@ -144,7 +144,7 @@ namespace Umbraco.Tests.Benchmarks
// however, unfortunately, the generated "compiled to delegate" code cannot access private stuff :(
_emittedCtor = ReflectionUtilities.EmitConstuctor<Func<IFoo, Foo>>();
_emittedCtor = ReflectionUtilities.EmitConstructor<Func<IFoo, Foo>>();
}
public IFoo IlCtor(IFoo foo)

View File

@@ -14,16 +14,16 @@ namespace Umbraco.Tests.Clr
[Test]
public void EmitCtorEmits()
{
var ctor1 = ReflectionUtilities.EmitConstuctor<Func<Class1>>();
var ctor1 = ReflectionUtilities.EmitConstructor<Func<Class1>>();
Assert.IsInstanceOf<Class1>(ctor1());
var ctor2 = ReflectionUtilities.EmitConstuctor<Func<object>>(declaring: typeof(Class1));
var ctor2 = ReflectionUtilities.EmitConstructor<Func<object>>(declaring: typeof(Class1));
Assert.IsInstanceOf<Class1>(ctor2());
var ctor3 = ReflectionUtilities.EmitConstuctor<Func<int, Class3>>();
var ctor3 = ReflectionUtilities.EmitConstructor<Func<int, Class3>>();
Assert.IsInstanceOf<Class3>(ctor3(42));
var ctor4 = ReflectionUtilities.EmitConstuctor<Func<int, object>>(declaring: typeof(Class3));
var ctor4 = ReflectionUtilities.EmitConstructor<Func<int, object>>(declaring: typeof(Class3));
Assert.IsInstanceOf<Class3>(ctor4(42));
}
@@ -44,14 +44,14 @@ namespace Umbraco.Tests.Clr
[Test]
public void EmitCtorEmitsPrivateCtor()
{
var ctor = ReflectionUtilities.EmitConstuctor<Func<string, Class3>>();
var ctor = ReflectionUtilities.EmitConstructor<Func<string, Class3>>();
Assert.IsInstanceOf<Class3>(ctor("foo"));
}
[Test]
public void EmitCtorThrowsIfNotFound()
{
Assert.Throws<InvalidOperationException>(() => ReflectionUtilities.EmitConstuctor<Func<bool, Class3>>());
Assert.Throws<InvalidOperationException>(() => ReflectionUtilities.EmitConstructor<Func<bool, Class3>>());
}
[Test]
@@ -64,7 +64,7 @@ namespace Umbraco.Tests.Clr
[Test]
public void EmitCtorReturnsNull()
{
Assert.IsNull(ReflectionUtilities.EmitConstuctor<Func<bool, Class3>>(false));
Assert.IsNull(ReflectionUtilities.EmitConstructor<Func<bool, Class3>>(false));
}
[Test]