Example #1
0
        public void Create_PropertyTypeMissmatch_Exception()
        {
            var          subject   = new ArrayBuilder();
            PropertyInfo missmatch = this.Property(nameof(TypeMismatch));

            Assert.That(() => subject.Create(missmatch, null), Throws.InstanceOf <FormatException>());
        }
Example #2
0
        public void Create_List_NoOp()
        {
            var          subject = new ArrayBuilder();
            PropertyInfo array   = this.Property(nameof(List));
            object       noOp    = subject.Create(array, null);

            Assert.That(noOp, Is.InstanceOf <NoSpecimen>());
        }
Example #3
0
        public void Create_NoValues_EmptyInstance()
        {
            var          subject  = new ArrayBuilder();
            PropertyInfo empty    = this.Property(nameof(Empty));
            object       instance = subject.Create(empty, null);

            Assert.That(instance, Is.InstanceOf(empty.PropertyType).And.Empty);
        }
Example #4
0
        public void Create_NotAProperty_NoOp()
        {
            var    subject      = new ArrayBuilder();
            object notAProperty = typeof(int);
            var    noOp         = subject.Create(notAProperty, null);

            Assert.That(noOp, Is.InstanceOf <NoSpecimen>());
        }
Example #5
0
        public void Create_CompatibleMultiConversion_Instance()
        {
            var          subject    = new ArrayBuilder();
            PropertyInfo compatible = this.Property(nameof(CompatibleMultiConversion));
            object       instance   = subject.Create(compatible, null);

            Assert.That(instance, Is.InstanceOf(compatible.PropertyType));
        }
Example #6
0
        public void Create_MultipleItems_Instance()
        {
            var          subject       = new ArrayBuilder();
            PropertyInfo multipleItems = this.Property(nameof(MultipleItems));
            object       instance      = subject.Create(multipleItems, null);

            Assert.That(instance, Is.InstanceOf(multipleItems.PropertyType).And.Length.GreaterThan(1));
        }
Example #7
0
        public void Create_SingleItem_Instance()
        {
            var          subject    = new ArrayBuilder();
            PropertyInfo singleItem = this.Property(nameof(SingleItem));
            object       instance   = subject.Create(singleItem, null);

            Assert.That(instance, Is.InstanceOf(singleItem.PropertyType).And.Length.EqualTo(1));
        }
Example #8
0
        public void Create_PropertyOfUnsupportedType_NoOp()
        {
            var          subject       = new ArrayBuilder();
            PropertyInfo unhandledType = this.Property(nameof(Unhandled));

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

            Assert.That(noOp, Is.InstanceOf <NoSpecimen>());
        }
Example #9
0
        public void Create_PropertyNotDecorated_NoOp()
        {
            var subject = new ArrayBuilder();

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

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