public void UseJsonRpcHandlerWithBuilderAndTypeAndPathWhenTypeDoesNotImplementInterface() { var builderMock = new Mock <IApplicationBuilder>(MockBehavior.Strict); Assert.ThrowsException <ArgumentException>(() => JsonRpcBuilderExtensions.UseJsonRpcHandler(builderMock.Object, typeof(object), default)); }
public void UseJsonRpcHandlerWithBuilderAndTypeAndPathWhenTypeIsNull() { var builderMock = new Mock <IApplicationBuilder>(MockBehavior.Strict); Assert.ThrowsException <ArgumentNullException>(() => JsonRpcBuilderExtensions.UseJsonRpcHandler(builderMock.Object, null, default)); }
public void UseJsonRpcHandlerWithBuilderAndTypeWhenTypeIsNotClass() { var builderMock = new Mock <IApplicationBuilder>(MockBehavior.Strict); Assert.ThrowsException <ArgumentException>(() => JsonRpcBuilderExtensions.UseJsonRpcHandler(builderMock.Object, typeof(int))); }
public void UseJsonRpcHandlerWithBuilderAndType() { var builderMock = new Mock <IApplicationBuilder>(MockBehavior.Strict); builderMock.Setup(o => o.New()) .Returns(builderMock.Object); builderMock.Setup(o => o.Use(It.IsNotNull <Func <RequestDelegate, RequestDelegate> >())) .Returns(builderMock.Object); builderMock.Setup(o => o.Build()) .Returns(c => Task.CompletedTask); JsonRpcBuilderExtensions.UseJsonRpcHandler(builderMock.Object, typeof(JsonRpcTestHandler2)); builderMock.Verify(o => o.Use(It.IsNotNull <Func <RequestDelegate, RequestDelegate> >()), Times.AtLeastOnce()); }
public void UseJsonRpcHandlerWithBuilderAndTypeAndPathWhenBuilderIsNull() { Assert.ThrowsException <ArgumentNullException>(() => JsonRpcBuilderExtensions.UseJsonRpcHandler(null, typeof(JsonRpcTestHandler2), default)); }
public void UseJsonRpcHandlerWithBuilderWhenBuilderIsNull() { Assert.ThrowsException <ArgumentNullException>(() => JsonRpcBuilderExtensions.UseJsonRpcHandler <JsonRpcTestHandler2>(null)); }