Exemplo n.º 1
0
        public void ByTypeInject()
        {
            const string TEST_STR = "test string";
            SunsetLake   lake     = new SunsetLake();

            lake.RegisterSingleton <string>(TEST_STR);

            var instance = new InjectTarget();

            new DependenciesInjector(instance, lake).Inject();
            Assert.IsTrue(instance.Str == TEST_STR);
        }
Exemplo n.º 2
0
        public void IntelliInject()
        {
            SunsetLake lake = new SunsetLake();

            lake.Register <DateTime>(() => DateTime.Now);

            var instance         = new InjectTarget();
            var originalDateTime = instance.CreateDateTime;

            new DependenciesInjector(instance, lake).Inject();
            Assert.IsTrue(instance.CreateDateTime != originalDateTime);
        }