Esempio n. 1
0
        public void NullableEnumWhenNotNull()
        {
            ReadWriteEnums target = new ReadWriteEnums();

            ValueSetter.SetFormattedValue(target, "NullableEnumField", "Bar");
            Assert.That(target.NullableEnumField, Is.EqualTo(TestEnum.Bar));
        }
Esempio n. 2
0
        public void IEnumerableOfIntField()
        {
            ReadWriteLists target = new ReadWriteLists();

            ValueSetter.SetFormattedValue(target, "IEnumerableOfInt", "123, 456");
            Assert.That(target.IEnumerableOfInt, Is.EquivalentTo(new int[] { 123, 456 }));
        }
Esempio n. 3
0
        public void EnumMethod()
        {
            ReadWriteEnums target = new ReadWriteEnums();

            ValueSetter.SetFormattedValue(target, "EnumMethod", "Bar");
            Assert.That(target.EnumProperty, Is.EqualTo(TestEnum.Bar));
        }
Esempio n. 4
0
        public void SettingFormatedValueOnDateTimeFieldUsesDateTimeParser()
        {
            ReadWriteDateTimes target = new ReadWriteDateTimes();

            target.DateTimeField = DateTime.MinValue;
            ValueSetter.SetFormattedValue(target, "DateTimeField", "Now");
            DateTimeParserTests.AssertThatDateTimeIsCloseEnoughToNow(target.DateTimeField);
        }
Esempio n. 5
0
        public void SettingFormatedValueOnInt32FieldUsesInt32Parser()
        {
            ReadWriteInts target = new ReadWriteInts();

            target.IntField = int.MinValue;
            ValueSetter.SetFormattedValue(target, "IntField", "123rd");
            Assert.That(target.IntField, Is.EqualTo(123));
        }
Esempio n. 6
0
        public void SettingFormatedValueOfNullOnStringFieldSetsItToNull()
        {
            ReadWriteStrings target = new ReadWriteStrings();

            target.StringField = "xxx";
            ValueSetter.SetFormattedValue(target, "StringField", null);
            Assert.That(target.StringField, Is.Null);
        }
Esempio n. 7
0
        public void SettingFormattedValueOfNullOnIntFieldSetsItTo0()
        {
            ReadWriteInts target = new ReadWriteInts();

            target.IntField = 123;
            ValueSetter.SetFormattedValue(target, "IntField", null);
            Assert.That(target.IntField, Is.EqualTo(0));
        }