public void ShouldBeAbleToRetrieve() { var method = new Mock<IReduceMethod<double>>(); var methodInstance = method.Object; var factoryProvider = new TestReduceMethodProvider(); factoryProvider.Factories.Add(methodInstance.GetType().FullName, methodInstance); var result = factoryProvider.Retrieve(methodInstance.GetType().FullName); Assert.Same(methodInstance, result); }
public void SHouldThrowExceptionWhenFactoryNotFound() { var factoryProvider = new TestReduceMethodProvider(); Assert.Throws<KeyNotFoundException>(() => factoryProvider.Retrieve("Test")); }