Exemple #1
0
        public void IsNullOrEmptyReturnsTrueWhenInstanceWritesTimeSpanPropertyWithNullValue()
        {
            var writer       = new TestableJsonWriter(null);
            var serializable = new StubIJsonSerializable {
                OnSerialize = w => w.WriteProperty("name", (TimeSpan?)null)
            };

            Assert.True(writer.IsNullOrEmpty(serializable));
        }
Exemple #2
0
        public void IsNullOrEmptyReturnsTrueWhenInstanceWritesStringPropertyWithEmptyValue()
        {
            var writer       = new TestableJsonWriter(null);
            var serializable = new StubIJsonSerializable {
                OnSerialize = w => w.WriteProperty("name", string.Empty)
            };

            Assert.True(writer.IsNullOrEmpty(serializable));
        }
Exemple #3
0
        public void IsNullOrEmptyReturnsFalseWhenInstanceWritesDateTimeOffsetProperty()
        {
            var writer       = new TestableJsonWriter(null);
            var serializable = new StubIJsonSerializable {
                OnSerialize = w => w.WriteProperty("name", DateTimeOffset.UtcNow)
            };

            Assert.False(writer.IsNullOrEmpty(serializable));
        }
Exemple #4
0
        public void IsNullOrEmptyReturnsFalseWhenInstanceWritesStringProperty()
        {
            var writer       = new TestableJsonWriter(null);
            var serializable = new StubIJsonSerializable {
                OnSerialize = w => w.WriteProperty("name", "value")
            };

            Assert.False(writer.IsNullOrEmpty(serializable));
        }
Exemple #5
0
        public void IsNullOrEmptyReturnsTrueWhenInstanceWritesIJsonSerializablePropertyWithNullValue()
        {
            var writer = new TestableJsonWriter(null);
            var parent = new StubIJsonSerializable {
                OnSerialize = w => w.WriteProperty("child", (IJsonSerializable)null)
            };

            Assert.True(writer.IsNullOrEmpty(parent));
        }
Exemple #6
0
        public void IsNullOrEmptyReturnsFalseWhenInstanceWritesTimeSpanProperty()
        {
            var writer       = new TestableJsonWriter(null);
            var serializable = new StubIJsonSerializable {
                OnSerialize = w => w.WriteProperty("name", TimeSpan.FromSeconds(0.0))
            };

            Assert.False(writer.IsNullOrEmpty(serializable));
        }
Exemple #7
0
        public void IsNullOrEmptyReturnsTrueWhenInstanceWritesRawObjectValueWithNullValue()
        {
            var writer       = new TestableJsonWriter(null);
            var serializable = new StubIJsonSerializable {
                OnSerialize = w => w.WriteRawValue(null)
            };

            Assert.True(writer.IsNullOrEmpty(serializable));
        }
Exemple #8
0
        public void IsNullOrEmptyReturnsTrueWhenInstanceWritesIDictionaryStringStringWithNullValue()
        {
            var writer   = new TestableJsonWriter(null);
            var instance = new StubIJsonSerializable {
                OnSerialize = w => w.WriteProperty("name", (IDictionary <string, string>)null)
            };

            Assert.True(writer.IsNullOrEmpty(instance));
        }
Exemple #9
0
        public void IsNullOrEmptyReturnsFalseWhenInstanceWritesIDictionaryStringStringProperty()
        {
            var writer   = new TestableJsonWriter(null);
            var instance = new StubIJsonSerializable {
                OnSerialize = w => w.WriteProperty("name", new Dictionary <string, string> {
                    { "name", "value" }
                })
            };

            Assert.False(writer.IsNullOrEmpty(instance));
        }
Exemple #10
0
        public void IsNullOrEmptyReturnsFalseWhenInstanceWritesIJsonSerializableProperty()
        {
            var writer = new TestableJsonWriter(null);
            var child  = new StubIJsonSerializable {
                OnSerialize = w => w.WriteProperty("name", "value")
            };
            var parent = new StubIJsonSerializable {
                OnSerialize = w => w.WriteProperty("child", child)
            };

            Assert.False(writer.IsNullOrEmpty(parent));
        }
 public void IsNullOrEmptyReturnsTrueWhenGivenIJsonSerializableInstanceIsNull()
 {
     var writer = new TestableJsonWriter(null);
     Assert.True(writer.IsNullOrEmpty(null));
 }
 public void IsNullOrEmptyReturnsTrueWhenInstanceWritesRawObjectValueWithNullValue()
 {
     var writer = new TestableJsonWriter(null);
     var serializable = new StubIJsonSerializable { OnSerialize = w => w.WriteRawValue(null) };
     Assert.True(writer.IsNullOrEmpty(serializable));
 }
 public void IsNullOrEmptyReturnsFalseWhenInstanceWritesIDictionaryStringStringProperty()
 {
     var writer = new TestableJsonWriter(null);
     var instance = new StubIJsonSerializable { OnSerialize = w => w.WriteProperty("name", new Dictionary<string, string> { { "name", "value" } }) };
     Assert.False(writer.IsNullOrEmpty(instance));
 }
 public void IsNullOrEmptyReturnsTrueWhenInstanceWritesIDictionaryStringStringWithNullValue()
 {
     var writer = new TestableJsonWriter(null);
     var instance = new StubIJsonSerializable { OnSerialize = w => w.WriteProperty("name", (IDictionary<string, string>)null) };
     Assert.True(writer.IsNullOrEmpty(instance));
 }
 public void IsNullOrEmptyReturnsTrueWhenInstanceWritesIJsonSerializablePropertyWithEmptyValue()
 {
     var writer = new TestableJsonWriter(null);
     var child = new StubIJsonSerializable();
     var parent = new StubIJsonSerializable { OnSerialize = w => w.WriteProperty("name", child) };
     Assert.True(writer.IsNullOrEmpty(parent));
 }
 public void IsNullOrEmptyReturnsTrueWhenInstanceWritesBoolPropertyWithNullValue()
 {
     var writer = new TestableJsonWriter(null);
     var serializable = new StubIJsonSerializable { OnSerialize = w => w.WriteProperty("name", (bool?)null) };
     Assert.True(writer.IsNullOrEmpty(serializable));
 }
Exemple #17
0
        public void IsNullOrEmptyReturnsTrueWhenGivenIJsonSerializableInstanceDoesNotWriteAnyProperties()
        {
            var writer = new TestableJsonWriter(null);

            Assert.True(writer.IsNullOrEmpty(new StubIJsonSerializable()));
        }
Exemple #18
0
        public void IsNullOrEmptyReturnsTrueWhenGivenIJsonSerializableInstanceIsNull()
        {
            var writer = new TestableJsonWriter(null);

            Assert.True(writer.IsNullOrEmpty(null));
        }
 public void IsNullOrEmptyReturnsTrueWhenGivenIJsonSerializableInstanceDoesNotWriteAnyProperties()
 {
     var writer = new TestableJsonWriter(null);
     Assert.True(writer.IsNullOrEmpty(new StubIJsonSerializable()));
 }
 public void IsNullOrEmptyReturnsFalseWhenInstanceWritesStringProperty()
 {
     var writer = new TestableJsonWriter(null);
     var serializable = new StubIJsonSerializable { OnSerialize = w => w.WriteProperty("name", "value") };
     Assert.False(writer.IsNullOrEmpty(serializable));
 }
 public void IsNullOrEmptyReturnsFalseWhenInstanceWritesTimeSpanProperty()
 {
     var writer = new TestableJsonWriter(null);
     var serializable = new StubIJsonSerializable { OnSerialize = w => w.WriteProperty("name", TimeSpan.FromSeconds(0.0)) };
     Assert.False(writer.IsNullOrEmpty(serializable));
 }
 public void IsNullOrEmptyReturnsFalseWhenInstanceWritesDateTimeOffsetProperty()
 {
     var writer = new TestableJsonWriter(null);
     var serializable = new StubIJsonSerializable { OnSerialize = w => w.WriteProperty("name", DateTimeOffset.UtcNow) };
     Assert.False(writer.IsNullOrEmpty(serializable));
 }
 public void IsNullOrEmptyReturnsFalseWhenInstanceWritesIJsonSerializableProperty()
 {
     var writer = new TestableJsonWriter(null);
     var child = new StubIJsonSerializable { OnSerialize = w => w.WriteProperty("name", "value") };
     var parent = new StubIJsonSerializable { OnSerialize = w => w.WriteProperty("child", child) };
     Assert.False(writer.IsNullOrEmpty(parent));
 }