コード例 #1
0
        public void AddJsonRpcHandlerWithServicesAndTypeWhenTypeIsNull()
        {
            var servicesMock = new Mock <IServiceCollection>(MockBehavior.Strict);

            Assert.ThrowsException <ArgumentNullException>(() =>
                                                           JsonRpcServicesExtensions.AddJsonRpcHandler(servicesMock.Object, null));
        }
コード例 #2
0
        public void AddJsonRpcHandlerWithServicesAndTypeWhenTypeDoesNotImplementInterface()
        {
            var servicesMock = new Mock <IServiceCollection>(MockBehavior.Strict);

            Assert.ThrowsException <ArgumentException>(() =>
                                                       JsonRpcServicesExtensions.AddJsonRpcHandler(servicesMock.Object, typeof(object)));
        }
コード例 #3
0
        public void AddJsonRpcHandlerWithServices()
        {
            var servicesMock = new Mock <IServiceCollection>(MockBehavior.Strict);

            servicesMock.Setup(o => o.GetEnumerator())
            .Returns(new List <ServiceDescriptor>().GetEnumerator());
            servicesMock.Setup(o => o.Add(It.IsNotNull <ServiceDescriptor>()));

            JsonRpcServicesExtensions.AddJsonRpcHandler <JsonRpcTestHandler1>(servicesMock.Object);

            servicesMock.Verify(o => o.Add(It.IsNotNull <ServiceDescriptor>()), Times.Once());
        }
コード例 #4
0
 public void AddJsonRpcHandlerWithServicesWhenServicesIsNull()
 {
     Assert.ThrowsException <ArgumentNullException>(() =>
                                                    JsonRpcServicesExtensions.AddJsonRpcHandler <JsonRpcTestHandler2>(null));
 }
コード例 #5
0
 public void AddJsonRpcHandlerWithServicesAndTypeWhenServicesIsNull()
 {
     Assert.ThrowsException <ArgumentNullException>(() =>
                                                    JsonRpcServicesExtensions.AddJsonRpcHandler(null, typeof(JsonRpcTestHandler2)));
 }