public void TestClientLoadAnyAssemblyInvalid() { RpcExceptionInfo exInfo = RpcExceptionInfo.CreateBuilder() .SetAssemblyName(@"Me.Oh.My") .SetFullTypeName("System.ASDF.Abc123Exception") .Build(); exInfo.ReThrow(RpcErrorTypeBehavior.LoadAnyAssembly); }
public void TestClientOnlyLoadStrongNamed() { //this test expects that System.Web.dll is not already loaded. foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies()) { Assert.AreNotEqual(a.GetName().Name, "System.Design"); } RpcExceptionInfo exInfo = RpcExceptionInfo.CreateBuilder() .SetAssemblyName("System.Design, Version=2.0.0.0, Culture=neutral") .SetFullTypeName("System.Data.Design.TypedDataSetGeneratorException") .Build(); Exception e = new Exception(); try { exInfo.ReThrow(RpcErrorTypeBehavior.OnlyLoadStrongNamed); } catch (Exception ex) { e = ex; } Assert.AreEqual(typeof(ApplicationException), e.GetType()); //now provide a key'd assembly name: exInfo = exInfo.ToBuilder().SetAssemblyName( "System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a").Build(); try { exInfo.ReThrow(RpcErrorTypeBehavior.OnlyLoadStrongNamed); } catch (Exception ex) { e = ex; } Assert.AreEqual("System.Data.Design.TypedDataSetGeneratorException", e.GetType().FullName); Assert.IsNotEmpty(e.Message); }
public void TestClientOnlyUseLoadedAssemblies() { //this test expects that System.Web.dll is not already loaded. foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies()) { Assert.AreNotEqual(a.GetName().Name, "System.Web"); } RpcExceptionInfo exInfo = RpcExceptionInfo.CreateBuilder() .SetAssemblyName("System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") .SetFullTypeName("System.Web.HttpCompileException") .Build(); Exception e = new Exception(); try { exInfo.ReThrow(RpcErrorTypeBehavior.OnlyUseLoadedAssemblies); } catch (Exception ex) { e = ex; } Assert.AreEqual(typeof(ApplicationException), e.GetType()); Assembly.Load(exInfo.AssemblyName); try { exInfo.ReThrow(RpcErrorTypeBehavior.OnlyUseLoadedAssemblies); } catch (Exception ex) { e = ex; } Assert.AreEqual("System.Web.HttpCompileException", e.GetType().FullName); Assert.IsNotEmpty(e.Message); }