public async Task UnserializableOutput_ThrowFaultException(string pipeName) { _serviceMock .Setup(x => x.UnserializableOutput()) .Returns(UnserializableObject.Create()); IIpcClient <ITestService> client = _factory .WithIpcHostConfiguration(hostBuilder => { hostBuilder.AddNamedPipeEndpoint <ITestService>(pipeName); }) .CreateClient((name, services) => { services.AddNamedPipeIpcClient <ITestService>(name, pipeName); }); #if !DISABLE_DYNAMIC_CODE_GENERATION IpcFaultException exception = await Assert.ThrowsAnyAsync <IpcFaultException>(async() => { await client.InvokeAsync(x => x.UnserializableOutput()); }); Assert.Equal(IpcStatus.InternalServerError, exception.Status); #endif IpcFaultException exception2 = await Assert.ThrowsAnyAsync <IpcFaultException>(async() => { var request = TestHelpers.CreateIpcRequest("UnserializableOutput"); await client.InvokeAsync(request); }); Assert.Equal(IpcStatus.InternalServerError, exception2.Status); }
public async Task UnserializableInput_ThrowSerializationException(string pipeName) { IIpcClient <ITestService> client = _factory .WithIpcHostConfiguration(hostBuilder => { hostBuilder.AddNamedPipeEndpoint <ITestService>(pipeName); }) .CreateClient((name, services) => { services.AddNamedPipeIpcClient <ITestService>(name, pipeName); }); #if !DISABLE_DYNAMIC_CODE_GENERATION await Assert.ThrowsAnyAsync <IpcSerializationException>(async() => { await client.InvokeAsync(x => x.UnserializableInput(UnserializableObject.Create())); }); #endif await Assert.ThrowsAnyAsync <IpcSerializationException>(async() => { var request = TestHelpers.CreateIpcRequest(typeof(ITestService), "UnserializableInput", UnserializableObject.Create()); await client.InvokeAsync(request); }); }
public async Task UnserializableInput_ThrowSerializationException(string pipeName) { IIpcClient <ITestService> client = _factory .WithIpcHostConfiguration(hostBuilder => { hostBuilder.AddNamedPipeEndpoint <ITestService>(pipeName); }) .CreateClient((name, services) => { services.AddNamedPipeIpcClient <ITestService>(name, pipeName); }); await Assert.ThrowsAnyAsync <IpcSerializationException>(async() => { await client.InvokeAsync(x => x.UnserializableInput(UnserializableObject.Create())); }); }
public async Task UnserializableOutput_ThrowFaultException(string pipeName) { _serviceMock .Setup(x => x.UnserializableOutput()) .Returns(UnserializableObject.Create()); IIpcClient <ITestService> client = _factory .WithIpcHostConfiguration(hostBuilder => { hostBuilder.AddNamedPipeEndpoint <ITestService>(pipeName); }) .CreateClient((name, services) => { services.AddNamedPipeIpcClient <ITestService>(name, pipeName); }); IpcFaultException exception = await Assert.ThrowsAnyAsync <IpcFaultException>(async() => { await client.InvokeAsync(x => x.UnserializableOutput()); }); Assert.Equal(IpcStatus.InternalServerError, exception.Status); }