Пример #1
0
        public void Create_PropertyTypeMissmatch_Exception()
        {
            var          subject   = new ScalarBuilder();
            PropertyInfo missmatch = this.Property(nameof(TypeMismatch));

            Assert.That(() => subject.Create(missmatch, null), Throws.InstanceOf <FormatException>());
        }
Пример #2
0
        public void Create_ExactConversion_Instance()
        {
            var          subject  = new ScalarBuilder();
            PropertyInfo exact    = this.Property(nameof(ExactType));
            object       instance = subject.Create(exact, null);

            Assert.That(instance, Is.InstanceOf(exact.PropertyType));
        }
Пример #3
0
        public void Create_CompatibleConversion_Instance()
        {
            var          subject    = new ScalarBuilder();
            PropertyInfo compatible = this.Property(nameof(CompatibleConversion));
            object       instance   = subject.Create(compatible, null);

            Assert.That(instance, Is.InstanceOf(compatible.PropertyType));
        }
Пример #4
0
        public void Create_NotAProperty_NoOp()
        {
            var    subject      = new ScalarBuilder();
            object notAProperty = typeof(int);
            var    noOp         = subject.Create(notAProperty, null);

            Assert.That(noOp, Is.InstanceOf <NoSpecimen>());
        }
Пример #5
0
        public void Create_PropertyOfUnsupportedType_NoOp()
        {
            var          subject       = new ScalarBuilder();
            PropertyInfo unhandledType = this.Property(nameof(Unhandled));

            var noOp = subject.Create(unhandledType, null);

            Assert.That(noOp, Is.InstanceOf <NoSpecimen>());
        }
Пример #6
0
        public void Create_PropertyNotDecorated_NoOp()
        {
            var subject = new ScalarBuilder();

            PropertyInfo notDecorated = this.Property(nameof(NotDecorated));
            var          noOp         = subject.Create(notDecorated, null);

            Assert.That(noOp, Is.InstanceOf <NoSpecimen>());
        }