public void DIBinding_ToFactory_IsInvalidOperationException() { // Arrange var actual = false; var instance = new TestFactory(); var reflector = new Reflector(); var container = new DiContainer(); var key = typeof(TestFactory); var binding = new DiBinding(reflector, container, key, null, null); binding.InGlobal().ToFactory(instance); // Act try { binding.ToFactory(instance); } catch (InvalidOperationException) { actual = true; } // Assert Assert.IsTrue(actual); }
public void DIBinding_ToFactory_IsNotNullException() { // Arrange var actual = false; var reflector = new Reflector(); var container = new DiContainer(); var key = typeof(TestFactory); var binding = new DiBinding(reflector, container, key, null, null); binding.InGlobal(); // Act try { binding.ToFactory(null); } catch (ArgumentNullException) { actual = true; } // Assert Assert.IsTrue(actual); }