Ejemplo n.º 1
0
        public void SetFieldByName_is_correct()
        {
            const int    number = 12;
            const string text   = "test_text";
            var          obj    = new TypeWithFields(number, text);
            var          type   = obj.GetType();

            type.SetFieldValueByName(obj, "_number", number * 2);
            type.SetFieldValueByName(obj, "_text", text + text);

            obj.Number.ShouldBe(24);
            obj._text.ShouldBe("test_texttest_text");
        }
Ejemplo n.º 2
0
        public void GetFieldsValues_is_correct()
        {
            const int    number = 12;
            const string text   = "test_text";
            var          obj    = new TypeWithFields(number, text);
            var          type   = obj.GetType();

            var fields = type.GetFieldsValues(obj);

            fields.Count.ShouldBe(2);
            fields["_number"].ShouldBe(number);
            fields["_text"].ShouldBe(text);
        }
Ejemplo n.º 3
0
        public void GetFieldByName_is_correct()
        {
            const int    number = 12;
            const string text   = "test_text";
            var          obj    = new TypeWithFields(number, text);
            var          type   = obj.GetType();

            type
            .GetFieldValueByName(obj, "_number")
            .ShouldBe(number);
            type
            .GetFieldValueByName(obj, "_text")
            .ShouldBe(text);
        }