private void InvalidOperationExceptionIsThrownIfServiceFactoryReturnsNullTestHelper( Func <ServiceFactoryBroker, IntPtr, IntPtr, uint, IntPtr, Guid, long, object> func) { var broker = ServiceFactoryBrokerTest.CreateServiceFactory <NullReturningStub>(); byte[] initializationData = ServiceFactoryBrokerTest.DefaultInitializationData; using (var pin = new PinBlittable(initializationData)) { TestUtility.ExpectException <InvalidOperationException>(() => { func( broker, ServiceFactoryBrokerTest.PtrDefaultServiceType, ServiceFactoryBrokerTest.PtrDefaultServiceUri, (uint)initializationData.Length, pin.AddrOfPinnedObject(), ServiceFactoryBrokerTest.DefaultPartitionId, ServiceFactoryBrokerTest.DefaultInstanceId); }); } }
private void ServiceCreationAndInstanceTypeMatchTestHelper <T>( Func <ServiceFactoryBroker, IntPtr, IntPtr, uint, IntPtr, Guid, long, object> func) where T : class, new() { var broker = ServiceFactoryBrokerTest.CreateServiceFactory <T>(); byte[] initializationData = ServiceFactoryBrokerTest.DefaultInitializationData; using (var pin = new PinBlittable(initializationData)) { TestUtility.ExpectException <InvalidOperationException>(() => { func( broker, ServiceFactoryBrokerTest.PtrDefaultServiceType, ServiceFactoryBrokerTest.PtrDefaultServiceUri, (uint)initializationData.Length, pin.AddrOfPinnedObject(), ServiceFactoryBrokerTest.DefaultPartitionId, ServiceFactoryBrokerTest.DefaultInstanceId); }); } }