コード例 #1
0
        public void setter_with_primitive_happy_path()
        {
            var instance = new ConfiguredInstance(typeof(ColorRule))
                           .Ctor <string>("color").Is("Red").Setter <int>("Age").Is(34);

            IConfiguredInstance configuredInstance = instance;

            configuredInstance.Dependencies.Get("color").ShouldBe("Red");
            configuredInstance.Dependencies.Get("Age").ShouldBe(34);

            instance.Ctor <string>("color").Is("Blue");
            configuredInstance.Dependencies.Get("color").ShouldBe("Blue");
        }
コード例 #2
0
        public void setter_with_primitive_happy_path()
        {
            ConfiguredInstance instance = new ConfiguredInstance(typeof(ColorRule))
                                          .Ctor <string>("color").Is("Red").Setter <int>("Age").Is(34);

            IConfiguredInstance configuredInstance = instance;


            Assert.AreEqual("Red", configuredInstance.GetProperty("color"));
            Assert.AreEqual("34", configuredInstance.GetProperty("Age"));

            instance.Ctor <string>("color").Is("Blue");
            Assert.AreEqual("Blue", configuredInstance.GetProperty("color"));
        }