예제 #1
0
        public void InjectionContext_SetValue_Dont_Override()
        {
            var context = new Grace.DependencyInjection.Impl.InjectionContext(null);

            context.SetExtraData(5, "Hello");

            Assert.Equal("Hello", context.GetExtraData(5));

            context.SetExtraData(5, "World", replaceIfExists: false);

            Assert.Equal("Hello", context.GetExtraData(5));
        }
예제 #2
0
        public void InjectionContext_GetValueByType()
        {
            var context = new Grace.DependencyInjection.Impl.InjectionContext(null);

            context.SetExtraData(5, "Hello");

            Assert.Equal("Hello", context.GetValueByType(typeof(string)));
        }
예제 #3
0
        public void InjectionContext_Value()
        {
            var context = new Grace.DependencyInjection.Impl.InjectionContext(null);

            context.SetExtraData("Hello", "World");

            var keys = context.Values.ToArray();

            Assert.Equal(1, keys.Length);
            Assert.Equal("World", keys[0]);
        }