예제 #1
0
        public void UseJsonRpcHandlerWithBuilderAndTypeAndPathWhenTypeDoesNotImplementInterface()
        {
            var builderMock = new Mock <IApplicationBuilder>(MockBehavior.Strict);

            Assert.ThrowsException <ArgumentException>(() =>
                                                       JsonRpcBuilderExtensions.UseJsonRpcHandler(builderMock.Object, typeof(object), default));
        }
예제 #2
0
        public void UseJsonRpcHandlerWithBuilderAndTypeAndPathWhenTypeIsNull()
        {
            var builderMock = new Mock <IApplicationBuilder>(MockBehavior.Strict);

            Assert.ThrowsException <ArgumentNullException>(() =>
                                                           JsonRpcBuilderExtensions.UseJsonRpcHandler(builderMock.Object, null, default));
        }
예제 #3
0
        public void UseJsonRpcHandlerWithBuilderAndTypeWhenTypeIsNotClass()
        {
            var builderMock = new Mock <IApplicationBuilder>(MockBehavior.Strict);

            Assert.ThrowsException <ArgumentException>(() =>
                                                       JsonRpcBuilderExtensions.UseJsonRpcHandler(builderMock.Object, typeof(int)));
        }
예제 #4
0
        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());
        }
예제 #5
0
 public void UseJsonRpcHandlerWithBuilderAndTypeAndPathWhenBuilderIsNull()
 {
     Assert.ThrowsException <ArgumentNullException>(() =>
                                                    JsonRpcBuilderExtensions.UseJsonRpcHandler(null, typeof(JsonRpcTestHandler2), default));
 }
예제 #6
0
 public void UseJsonRpcHandlerWithBuilderWhenBuilderIsNull()
 {
     Assert.ThrowsException <ArgumentNullException>(() =>
                                                    JsonRpcBuilderExtensions.UseJsonRpcHandler <JsonRpcTestHandler2>(null));
 }