public void TestWithAttributedObject() { Mock<ILifetimeManagerMap> mockedMap = new Mock<ILifetimeManagerMap>(); UseLifetimeManagerAttributeStrategyImpl testStrategy = new UseLifetimeManagerAttributeStrategyImpl(); Assert.AreEqual(typeof(ContainerManagedLifetimeManager), testStrategy.FindLifetimeManager(typeof(AttributedWithLifetimeManager), String.Empty)); Assert.AreEqual(typeof(ExternallyControlledLifetimeManager), testStrategy.FindLifetimeManager(typeof(AttributedWithLifetimeManager), "weak")); }
public void TestNoAttributesWithNextStep() { Mock<ILifetimeManagerMap> mockedMap = new Mock<ILifetimeManagerMap>(); UseLifetimeManagerAttributeStrategyImpl testStrategy = new UseLifetimeManagerAttributeStrategyImpl(); Mock<FindLifetimeManagerStrategy> mockedNextStep = new Mock<FindLifetimeManagerStrategy>(); testStrategy.NextStep = mockedNextStep.Object; testStrategy.FindLifetimeManager(typeof(object), "identifier"); mockedNextStep.Verify(step => step.FindLifetimeManager(It.IsAny<Type>(), It.IsAny<string>())); }
public void TestNoAttributesNoNextStep() { Mock<ILifetimeManagerMap> mockedMap = new Mock<ILifetimeManagerMap>(); UseLifetimeManagerAttributeStrategyImpl testStrategy = new UseLifetimeManagerAttributeStrategyImpl(); Assert.IsNull(testStrategy.FindLifetimeManager(typeof(object), "identifier")); }