示例#1
0
 public void RegisterSingleton_NotImplementClass_ThrowExeption()
 {
     // Arrange
     ioc.Setup(i => i.RegisterSingleton <IBase>(It.IsAny <Sub>())).Throws <IOCException>();
     // Act
     Labo.RegisterSingleton <IBase>(new Sub());
 }
示例#2
0
        public void RegisterSingleton_IBaseWithBase_Success()
        {
            // Arrange
            var value = new Base();

            // Act
            Labo.RegisterSingleton <IBase>(value);
            // Assert
            ioc.Verify(i => i.RegisterSingleton <IBase>(value));
        }
示例#3
0
        void SetRepository(string keyValuePairsFilePath)
        {
            var configurtion = Labo.Resolve <IConfigurationSettings>();
            IFormatKeyValuePairsRepository repository = null;

            if (configurtion.IsXmlMode)
            {
                repository = new FormatKeyValuePairsXmlRepository(keyValuePairsFilePath);
            }
            else
            {
                repository = new FormatKeyValuePairsRepository(keyValuePairsFilePath,
                                                               Labo.Resolve <FormacchanLibrary.Services.IFormatKeyValuePairsService>(), configurtion);
            }

            Labo.RegisterSingleton <IFormatKeyValuePairsRepository>(repository);
        }
示例#4
0
 void RegisterSingleton()
 {
     Labo.RegisterSingleton <ICountersRepository>(new CountersTemporarilyRepository());
     Labo.RegisterSingleton <IMessenger>(new MessageHub(Labo.Resolve <IPostsService>()));
 }
示例#5
0
 void SetInterfaceImplement()
 {
     Labo.RegisterSingleton <ICounterRepository>(new CounterRepository());
     Labo.Register <ICounterService, CounterService>();
 }
示例#6
0
        private void RegisterSingleton(string keyValuePairsFilePath)
        {
            Labo.RegisterSingleton <IConfigurationSettings>(new ConfigurationSettingFromConfigFile());

            SetRepository(keyValuePairsFilePath);
        }