예제 #1
0
        public void ShouldSetNullInNullablePrimitiveInInstance()
        {
            Nullable     nullable = new Nullable();
            PropertyInfo info     = typeof(Nullable).GetProperty("Value");
            ReflectorProperty <Nullable, long?> property = new ReflectorProperty <Nullable, long?>(info);

            property.SetNull(nullable);
            Assert.That(nullable.Value, Is.Null);
        }
예제 #2
0
 public int Transfer(Addressable source, long index, T destination)
 {
     if (source.Get(index) == 0)
     {
         nullable.SetNull(destination);
         return(1);
     }
     ;
     return(inner.Transfer(source, index + 1, destination) + 1);
 }
예제 #3
0
        public void ShouldSetNullInNullableStringInInstance()
        {
            Regular regular = new Regular {
                Value = "abc"
            };
            PropertyInfo info = typeof(Regular).GetProperty("Value");
            ReflectorProperty <Regular, string> property = new ReflectorProperty <Regular, string>(info);

            property.SetNull(regular);
            Assert.That(regular.Value, Is.Null);
        }
예제 #4
0
        public void ShouldSetNullInNullableStringInSubstitute()
        {
            Addressable          source     = new MemoryMock();
            Serializer <Regular> serializer = new Serializer <Regular>();
            Substitute <Regular> regular    = new Substitute <Regular>(serializer, source);

            PropertyInfo info = typeof(Regular).GetProperty("Value");
            ReflectorProperty <Regular, string> property = new ReflectorProperty <Regular, string>(info);

            property.SetNull(regular);
            Assert.That(regular.AsDynamic().Value, Is.Null);
        }
예제 #5
0
        public void ShouldSetNullInNullablePrimitiveInSubstitute()
        {
            Addressable           source     = new MemoryMock();
            Serializer <Nullable> serializer = new Serializer <Nullable>();
            Substitute <Nullable> nullable   = new Substitute <Nullable>(serializer, source);

            PropertyInfo info = typeof(Nullable).GetProperty("Value");
            ReflectorProperty <Nullable, long?> property = new ReflectorProperty <Nullable, long?>(info);

            property.SetNull(nullable);
            Assert.That(nullable.AsDynamic().Value, Is.Null);
        }