예제 #1
0
        public void OneProperty()
        {
            var o = new OnePropertyClass {
                MyProperty = "foo"
            };

            AssertEquals(o.MyProperty, "foo");
        }
예제 #2
0
        public void OneField()
        {
            var o = new OnePropertyClass {
                MyField = "foo"
            };

            AssertEquals(o.MyField, "foo");
        }
예제 #3
0
        public void OneField()
        {
            var o = new OnePropertyClass {
                MyField = "foo"
            };

            QUnit.AreEqual(o.MyField, "foo");
        }
예제 #4
0
        public void OneProperty()
        {
            var o = new OnePropertyClass {
                MyProperty = "foo"
            };

            QUnit.AreEqual(o.MyProperty, "foo");
        }
 public void OneProperty()
 {
     var obj = new OnePropertyClass();
     string propertyName = null;
     obj.PropertyChanged += (sender, evt) => propertyName = evt.PropertyName;
     obj.StringProperty = "foo";
     AssertEquals(propertyName, "StringProperty");
 }
예제 #6
0
        public void OneProperty()
        {
            var    obj          = new OnePropertyClass();
            string propertyName = null;

            obj.PropertyChanged += (sender, evt) => propertyName = evt.PropertyName;
            obj.StringProperty   = "foo";
            QUnit.AreEqual(propertyName, "StringProperty");
        }
예제 #7
0
        public void GetConfContents_GetsOneProperty()
        {
            var contents = new OnePropertyClass {
                StringProp = "The value"
            }.GetConfContents();
            var expected = new KeyValuePair <string, string>("OnePropertyClass.StringProp", "The value");
            var actual   = contents.Single();

            Assert.That(actual, Is.EqualTo(expected));
        }
예제 #8
0
        public void Nested()
        {
            var o = new OnePropertyClass {
                NestedProperty = new OnePropertyClass {
                    MyProperty = "foo"
                }
            };

            AssertEquals(o.NestedProperty.MyProperty, "foo");
        }
예제 #9
0
        public void Nested()
        {
            var o = new OnePropertyClass {
                NestedProperty = new OnePropertyClass {
                    MyProperty = "foo"
                }
            };

            QUnit.AreEqual(o.NestedProperty.MyProperty, "foo");
        }
        public void CanInjectProperties()
        {
            TestingBuilderContext context = GetContext();
            object existingObject         = new object();

            context.Locator.Add(typeof(object), existingObject);
            context.Policies.Set <ISingletonPolicy>(new SingletonPolicy(true), typeof(object));

            IBuildPlanPolicy plan =
                GetPlanCreator(context).CreatePlan(context, typeof(OnePropertyClass));

            OnePropertyClass existing = new OnePropertyClass();

            context.Existing = existing;
            context.BuildKey = typeof(OnePropertyClass);
            plan.BuildUp(context);

            Assert.IsNotNull(existing.Key);
            Assert.AreSame(existingObject, existing.Key);
        }
        public void CanInjectProperties()
        {
            TestingBuilderContext context          = GetContext();
            object existingObject                  = new object();
            SingletonLifetimePolicy lifetimePolicy = new SingletonLifetimePolicy();

            lifetimePolicy.SetValue(existingObject);
            context.Policies.Set <ILifetimePolicy>(lifetimePolicy, typeof(object));

            IBuildPlanPolicy plan =
                GetPlanCreator(context).CreatePlan(context, typeof(OnePropertyClass));

            OnePropertyClass existing = new OnePropertyClass();

            context.Existing = existing;
            context.BuildKey = typeof(OnePropertyClass);
            plan.BuildUp(context);

            Assert.IsNotNull(existing.Key);
            Assert.AreSame(existingObject, existing.Key);
        }
예제 #12
0
        public void CanInjectProperties()
        {
            MockBuilderContext context        = GetContext();
            object             existingObject = new object();
            var lifetimePolicy = new ContainerControlledLifetimeManager();

            lifetimePolicy.SetValue(existingObject);
            context.Policies.Set <ILifetimePolicy>(lifetimePolicy, new NamedTypeBuildKey <object>());

            IBuildPlanPolicy plan =
                GetPlanCreator(context).CreatePlan(context, new NamedTypeBuildKey(typeof(OnePropertyClass)));

            OnePropertyClass existing = new OnePropertyClass();

            context.Existing = existing;
            context.BuildKey = new NamedTypeBuildKey(typeof(OnePropertyClass));
            plan.BuildUp(context);

            Assert.NotNull(existing.Key);
            Assert.Same(existingObject, existing.Key);
        }