public void ForceUnsignedFalse() { var classEmitter = new CustomClassEmitter(Scope, "ForceUnsignedFalse", typeof(object), Type.EmptyTypes, TypeAttributes.Public, false); Type t = classEmitter.BuildType(); Assert.That(StrongNameUtil.IsAssemblySigned(t.Assembly), Is.True); }
public void ForceUnsignedTrueWithSignedTypes() { ClassEmitter emitter = new ClassEmitter(generator.ProxyBuilder.ModuleScope, "Foo", typeof(object), Type.EmptyTypes, TypeAttributes.Public, true); Type t = emitter.BuildType(); Assert.IsFalse(StrongNameUtil.IsAssemblySigned(t.Assembly)); }
public void ProxyForBaseTypeFromUnsignedAssembly() { Type t = typeof(Class); Assert.False(StrongNameUtil.IsAssemblySigned(t.Assembly)); object proxy = generator.CreateClassProxy(t, new StandardInterceptor()); Assert.False(StrongNameUtil.IsAssemblySigned(proxy.GetType().Assembly)); }
public void ForceUnsignedFalseWithSignedTypes() { const bool shouldBeSigned = true; ClassEmitter emitter = new ClassEmitter(generator.ProxyBuilder.ModuleScope, "Foo", typeof(object), Type.EmptyTypes, TypeAttributes.Public, false); Type t = emitter.BuildType(); Assert.AreEqual(shouldBeSigned, StrongNameUtil.IsAssemblySigned(t.Assembly)); }
public void ProxyForBaseTypeFromSignedAssembly() { const bool shouldBeSigned = true; Type t = typeof(List <object>); Assert.IsTrue(StrongNameUtil.IsAssemblySigned(t.Assembly)); object proxy = generator.CreateClassProxy(t, new StandardInterceptor()); Assert.AreEqual(shouldBeSigned, StrongNameUtil.IsAssemblySigned(proxy.GetType().Assembly)); }
public void ProxyForBaseTypeAndInterfaceFromSignedAndUnsignedAssemblies2() { Type t1 = typeof(List <int>); Type t2 = typeof(IInterface); Assert.IsTrue(StrongNameUtil.IsAssemblySigned(t1.Assembly)); Assert.IsFalse(StrongNameUtil.IsAssemblySigned(t2.Assembly)); object proxy = generator.CreateClassProxy(t1, new Type[] { t2 }, new StandardInterceptor()); Assert.IsFalse(StrongNameUtil.IsAssemblySigned(proxy.GetType().Assembly)); }
public void ProxyForBaseTypeAndInterfaceFromSignedAndUnsignedAssemblies1() { Type t1 = typeof(Class); Type t2 = typeof(IServiceProvider); Assert.IsFalse(StrongNameUtil.IsAssemblySigned(t1.GetTypeInfo().Assembly)); Assert.IsTrue(StrongNameUtil.IsAssemblySigned(t2.GetTypeInfo().Assembly)); object proxy = generator.CreateClassProxy(t1, new Type[] { t2 }, new StandardInterceptor()); Assert.IsFalse(StrongNameUtil.IsAssemblySigned(proxy.GetType().GetTypeInfo().Assembly)); }
public void ProxyForBaseTypeAndInterfaceFromSignedAssembly() { const bool shouldBeSigned = true; Type t1 = typeof(List <object>); Type t2 = typeof(IServiceProvider); Assert.IsTrue(StrongNameUtil.IsAssemblySigned(t1.Assembly)); Assert.IsTrue(StrongNameUtil.IsAssemblySigned(t2.Assembly)); object proxy = generator.CreateClassProxy(t1, new Type[] { t2 }, new StandardInterceptor()); Assert.AreEqual(shouldBeSigned, StrongNameUtil.IsAssemblySigned(proxy.GetType().Assembly)); }
public void ForceUnsignedFalseWithSignedTypes() { #if SILVERLIGHT // Silverlight does not allow us to sign generated assemblies const bool shouldBeSigned = false; #else const bool shouldBeSigned = true; #endif ClassEmitter emitter = new ClassEmitter(generator.ProxyBuilder.ModuleScope, "Foo", typeof(object), Type.EmptyTypes, TypeAttributes.Public, false); Type t = emitter.BuildType(); Assert.AreEqual(shouldBeSigned, StrongNameUtil.IsAssemblySigned(t.Assembly)); }
public void ProxyForBaseTypeFromUnsignedAssembly() { if (TestAssemblySigned()) { Assert.Ignore("To get this running, the Tests project must not be signed."); } Type t = typeof(MyClass); Assert.IsFalse(StrongNameUtil.IsAssemblySigned(t.Assembly)); object proxy = generator.CreateClassProxy(t, new StandardInterceptor()); Assert.IsFalse(StrongNameUtil.IsAssemblySigned(proxy.GetType().Assembly)); }
public void ProxyForBaseTypeAndInterfaceFromSignedAssembly() { #if SILVERLIGHT //Silverlight does not allow us to sign generated assemblies const bool shouldBeSigned = false; #else const bool shouldBeSigned = true; #endif Type t1 = typeof(List <object>); Type t2 = typeof(IServiceProvider); Assert.IsTrue(StrongNameUtil.IsAssemblySigned(t1.Assembly)); Assert.IsTrue(StrongNameUtil.IsAssemblySigned(t2.Assembly)); object proxy = generator.CreateClassProxy(t1, new Type[] { t2 }, new StandardInterceptor()); Assert.AreEqual(shouldBeSigned, StrongNameUtil.IsAssemblySigned(proxy.GetType().Assembly)); }
public void ProxyForBaseTypeFromSignedAssembly() { #if SILVERLIGHT #warning Silverlight does not allow us to sign generated assemblies const bool shouldBeSigned = false; #else const bool shouldBeSigned = true; #endif Type t = typeof(List <object>); Assert.IsTrue(StrongNameUtil.IsAssemblySigned(t.Assembly)); object proxy = generator.CreateClassProxy(t, new StandardInterceptor()); Assert.AreEqual(shouldBeSigned, StrongNameUtil.IsAssemblySigned(proxy.GetType().Assembly)); }
public void ProxyForBaseTypeAndInterfaceFromSignedAndUnsignedAssemblies2() { if (TestAssemblySigned()) { Assert.Ignore("To get this running, the Tests project must not be signed."); } Type t1 = typeof(List <int>); Type t2 = typeof(IService); Assert.IsTrue(StrongNameUtil.IsAssemblySigned(t1.Assembly)); Assert.IsFalse(StrongNameUtil.IsAssemblySigned(t2.Assembly)); object proxy = generator.CreateClassProxy(t1, new Type[] { t2 }, new StandardInterceptor()); Assert.IsFalse(StrongNameUtil.IsAssemblySigned(proxy.GetType().Assembly)); }
public void ProxyForBaseTypeAndInterfaceFromSignedAndUnsignedAssemblies1() { if (TestAssemblySigned()) { Assert.Ignore("To get this running, the Tests project must not be signed."); } var t1 = typeof(OutRefParamsTestCase.MyClass); var t2 = typeof(IServiceProvider); Assert.IsFalse(StrongNameUtil.IsAssemblySigned(t1.Assembly)); Assert.IsTrue(StrongNameUtil.IsAssemblySigned(t2.Assembly)); var proxy = generator.CreateClassProxy(t1, new[] { t2 }, new StandardInterceptor()); Assert.IsFalse(StrongNameUtil.IsAssemblySigned(proxy.GetType().Assembly)); }
private bool TestAssemblySigned() { return(StrongNameUtil.IsAssemblySigned(GetType().Assembly)); }