public object GetService(Type type) { if (type == typeof(IHandlerRegistrar)) { return(new TestHandleRegistrar()); } if (type == typeof(TestAggregateDidSomethingHandler)) { var handler = new TestAggregateDidSomethingHandler(); Handlers.Add(handler); return(handler); } if (type == typeof(TestAggregateDidSomethingInternalHandler)) { var handler = new TestAggregateDidSomethingInternalHandler(); Handlers.Add(handler); return(handler); } if (type == typeof(TestAggregateDoSomethingElseHandler)) { var handler = new TestAggregateDoSomethingElseHandler(); Handlers.Add(handler); return(handler); } if (type == typeof(TestAggregateDoSomethingHandler)) { var handler = new TestAggregateDoSomethingHandler(); Handlers.Add(handler); return(handler); } throw new ArgumentException("Type not registered"); }
public object GetService(Type type) { if (type == typeof(IHandlerRegistrar)) { return(new TestHandleRegistrar()); } if (type == typeof(TestAggregateDidSomethingHandler)) { var handler = new TestAggregateDidSomethingHandler(); Handlers.Add(handler); return(handler); } if (type == typeof(TestAggregateDoSomethingElseHandler)) { var handler = new TestAggregateDoSomethingElseHandler(); Handlers.Add(handler); return(handler); } else { var handler = new TestAggregateDoSomethingHandler(); Handlers.Add(handler); return(handler); } }
public object GetService(Type type) { if (ReturnNull) { return(null); } if (type == typeof(IHandlerRegistrar)) { return(_registrar); } if (type == typeof(TestAggregateDidSomethingHandler)) { var handler = new TestAggregateDidSomethingHandler(); Handlers.Add(handler); return(handler); } if (type == typeof(TestAggregateDidSomethingInternalHandler)) { var handler = new TestAggregateDidSomethingInternalHandler(); Handlers.Add(handler); return(handler); } if (type == typeof(TestAggregateDoSomethingElseHandler)) { var handler = new TestAggregateDoSomethingElseHandler(); Handlers.Add(handler); return(handler); } if (type == typeof(TestAggregateDoSomethingHandler)) { var handler = new TestAggregateDoSomethingHandler(); Handlers.Add(handler); return(handler); } if (type == typeof(TestAggregateDoSomethingHandlerExplicit)) { var handler = new TestAggregateDoSomethingHandlerExplicit(); Handlers.Add(handler); return(handler); } if (type == typeof(TestAggregateDoSomethingHandlerExplicit2)) { var handler = new TestAggregateDoSomethingHandlerExplicit2(); Handlers.Add(handler); return(handler); } if (type == typeof(AllHandler)) { var handler = new AllHandler(); Handlers.Add(handler); return(handler); } throw new ArgumentException($"Type {type.Name} not registered"); }