コード例 #1
0
 public void TestAdd()
 {
     LifetimeManagerMappingCollection collection = new LifetimeManagerMappingCollection();
       LifetimeManagerMappingConfigurationElement element = new LifetimeManagerMappingConfigurationElement();
       collection.Add(element);
       LifetimeManagerMappingConfigurationElement[] returnedElements = new LifetimeManagerMappingConfigurationElement[1];
       collection.CopyTo(returnedElements, 0);
       Assert.AreEqual(element, returnedElements[0]);
 }
コード例 #2
0
 public void TestParsingLifetimeManager()
 {
     ConfigurationSectionHelper helper = new ConfigurationSectionHelper();
       LifetimeManagerMappingConfigurationElement element = new LifetimeManagerMappingConfigurationElement();
       element.LifetimeManagerTypeName = "RockSolidIoc.Tests.MockFriendlyLifetimeManager";
       element.TypeName = "System.Object";
       LifetimeManagerMappingCollection collection = new LifetimeManagerMappingCollection();
       collection.Add(element);
       helper.LifetimeManagerMappings = collection;
       Configurator testConfigurator = new Configurator();
       IIocContainer result = testConfigurator.Configure(helper);
       object s = result.Resolve<object>();
       MockFriendlyLifetimeManager.Mock.Verify(p => p.AddInstance(It.IsAny<object>()), Times.Exactly(1));
       MockFriendlyLifetimeManager.ResetMock();
 }