public void AddJsonRpcHandlerWithServicesAndTypeWhenTypeIsNull() { var servicesMock = new Mock <IServiceCollection>(MockBehavior.Strict); Assert.ThrowsException <ArgumentNullException>(() => JsonRpcServicesExtensions.AddJsonRpcHandler(servicesMock.Object, null)); }
public void AddJsonRpcHandlerWithServicesAndTypeWhenTypeDoesNotImplementInterface() { var servicesMock = new Mock <IServiceCollection>(MockBehavior.Strict); Assert.ThrowsException <ArgumentException>(() => JsonRpcServicesExtensions.AddJsonRpcHandler(servicesMock.Object, typeof(object))); }
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()); }
public void AddJsonRpcHandlerWithServicesWhenServicesIsNull() { Assert.ThrowsException <ArgumentNullException>(() => JsonRpcServicesExtensions.AddJsonRpcHandler <JsonRpcTestHandler2>(null)); }
public void AddJsonRpcHandlerWithServicesAndTypeWhenServicesIsNull() { Assert.ThrowsException <ArgumentNullException>(() => JsonRpcServicesExtensions.AddJsonRpcHandler(null, typeof(JsonRpcTestHandler2))); }