public void Create_DomainServiceContext() { var context = new MockDomainServiceContext(DomainOperationType.Query); // Create proxy, verify it's not null. var proxy = DomainServiceProxy.Create <IMockDomainServiceContract, MockDomainService>(context); Assert.IsNotNull(proxy); // Examine its Context property PropertyInfo contextProp = proxy.GetType().GetProperty("Context"); DomainServiceContext proxyContext = (DomainServiceContext)contextProp.GetGetMethod().Invoke(proxy, null); Assert.AreSame(context, proxyContext); // Examine its DomainServiceType property PropertyInfo typeProp = proxy.GetType().GetProperty("DomainServiceType"); Type proxyType = (Type)typeProp.GetGetMethod().Invoke(proxy, null); Assert.AreEqual(typeof(MockDomainService), proxyType); }
public void Create_DomainServiceContext() { var context = new MockDomainServiceContext(DomainOperationType.Query); // Create proxy, verify it's not null. var proxy = DomainServiceProxy.Create<IMockDomainServiceContract, MockDomainService>(context); Assert.IsNotNull(proxy); // Examine its Context property PropertyInfo contextProp = proxy.GetType().GetProperty("Context"); DomainServiceContext proxyContext = (DomainServiceContext)contextProp.GetGetMethod().Invoke(proxy, null); Assert.AreSame(context, proxyContext); // Examine its DomainServiceType property PropertyInfo typeProp = proxy.GetType().GetProperty("DomainServiceType"); Type proxyType = (Type)typeProp.GetGetMethod().Invoke(proxy, null); Assert.AreEqual(typeof(MockDomainService), proxyType); }