Пример #1
0
        public void It_doesnt_end_up_with_superflous_attributes_by_calling_SetAttrValue()
        {
            // Arrange
            var it = new IdmResource {
                Description = "foo"
            };
            var attrCountBefore = it.Attributes.Count;

            it.SetAttrValue("Description", "bar");
            it.SetAttrValue("Description", "bar");
            it.SetAttrValue("Description", "bar");

            var attrCountAfter = it.Attributes.Count;

            Assert.AreEqual(attrCountBefore, attrCountAfter);
        }
Пример #2
0
        public void It_should_be_able_to_set_string_based_single_value_properties()
        {
            var it = new IdmResource();

            it.ObjectID = "foo";
            Assert.AreEqual("foo", it.ObjectID);

            it.ObjectType = "foo";
            Assert.AreEqual("foo", it.ObjectType);

            it.Description = "foo";
            Assert.AreEqual("foo", it.Description);

            it.DisplayName = "foo";
            Assert.AreEqual("foo", it.DisplayName);

            it.MVObjectID = "foo";
            Assert.AreEqual("foo", it.MVObjectID);

            it.Locale = "foo";
            Assert.AreEqual("foo", it.Locale);

            // and attributes
            it.SetAttrValue("foo", "bar");
            Assert.AreEqual("bar", it.GetAttrValue("foo"));
        }
Пример #3
0
        public void It_can_SetAttrValue_on_an_attribute_that_already_has_a_value()
        {
            var it = new IdmResource {
                Description = "foo"
            };

            it.SetAttrValue("Description", "bar");

            Assert.AreEqual("bar", it.Description);
        }
Пример #4
0
        public void It_can_SettAttrValue_nullable_null_value_and_come_back_as_null_as_either_Value_or_ToInt()
        {
            var it = new IdmResource();

            it.SetAttrValue("foo", null);

            var result1 = it.GetAttrValue("foo");
            var result2 = it.GetAttr("foo").ToInteger();
            var result3 = it.GetAttr("foo").ToDateTime();
            var result4 = it.GetAttr("foo").ToBinary();
            var result5 = it.GetAttr("foo").ToBool();

            Assert.IsNull(result1);
            Assert.IsNull(result2);
            Assert.IsNull(result3);
            Assert.IsNull(result4);
            Assert.IsNull(result5);
        }
Пример #5
0
        public void It_should_be_able_to_set_string_based_single_value_properties()
        {
            var it = new IdmResource();

            it.ObjectID = "foo";
            Assert.AreEqual("foo", it.ObjectID);

            it.ObjectType = "foo";
            Assert.AreEqual("foo", it.ObjectType);

            it.Description = "foo";
            Assert.AreEqual("foo", it.Description);

            it.DisplayName = "foo";
            Assert.AreEqual("foo", it.DisplayName);

            it.MVObjectID = "foo";
            Assert.AreEqual("foo", it.MVObjectID);

            it.Locale = "foo";
            Assert.AreEqual("foo", it.Locale);

            // and attributes
            it.SetAttrValue("foo", "bar");
            Assert.AreEqual("bar", it.GetAttrValue("foo"));
        }
Пример #6
0
        public void It_doesnt_end_up_with_superflous_attributes_by_calling_SetAttrValue()
        {
            // Arrange
            var it = new IdmResource { Description = "foo" };
            var attrCountBefore = it.Attributes.Count;

            it.SetAttrValue("Description", "bar");
            it.SetAttrValue("Description", "bar");
            it.SetAttrValue("Description", "bar");

            var attrCountAfter = it.Attributes.Count;

            Assert.AreEqual(attrCountBefore, attrCountAfter);
        }
Пример #7
0
        public void It_can_SettAttrValue_nullable_null_value_and_come_back_as_null_as_either_Value_or_ToInt()
        {
            var it = new IdmResource();

            it.SetAttrValue("foo", null);

            var result1 = it.GetAttrValue("foo");
            var result2 = it.GetAttr("foo").ToInteger();
            var result3 = it.GetAttr("foo").ToDateTime();
            var result4 = it.GetAttr("foo").ToBinary();
            var result5 = it.GetAttr("foo").ToBool();

            Assert.IsNull(result1);
            Assert.IsNull(result2);
            Assert.IsNull(result3);
            Assert.IsNull(result4);
            Assert.IsNull(result5);
        }
Пример #8
0
        public void It_can_SetAttrValue_on_an_attribute_that_already_has_a_value()
        {
            var it = new IdmResource { Description = "foo" };

            it.SetAttrValue("Description", "bar");

            Assert.AreEqual("bar", it.Description);
        }