本文整理汇总了C#中Collection.JsonSerialize方法的典型用法代码示例。如果您正苦于以下问题:C# Collection.JsonSerialize方法的具体用法?C# Collection.JsonSerialize怎么用?C# Collection.JsonSerialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Collection
的用法示例。
在下文中一共展示了Collection.JsonSerialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: op_JsonSerialize_object_whenCollectionOfString
public void op_JsonSerialize_object_whenCollectionOfString(string expected)
{
var obj = new Collection<string>
{
"abc",
"xyz"
};
var actual = obj.JsonSerialize();
Assert.Equal(expected, actual);
}
示例2: op_JsonSerialize_object_whenCollectionOfObjectType
public void op_JsonSerialize_object_whenCollectionOfObjectType(string expected)
{
var obj = new Collection<object>
{
new object(),
new object()
};
var actual = obj.JsonSerialize();
Assert.Equal(expected, actual);
}
示例3: op_JsonSerialize_object_whenCollectionOfSingle
public void op_JsonSerialize_object_whenCollectionOfSingle(string expected)
{
var obj = new Collection<float>
{
1.23f,
4.56f
};
var actual = obj.JsonSerialize();
Assert.Equal(expected, actual);
}
示例4: op_JsonSerialize_object_whenCollectionOfInt16
public void op_JsonSerialize_object_whenCollectionOfInt16(string expected)
{
var obj = new Collection<short>
{
123,
456
};
var actual = obj.JsonSerialize();
Assert.Equal(expected, actual);
}
示例5: op_JsonSerialize_object_whenCollectionOfNull
public void op_JsonSerialize_object_whenCollectionOfNull(string expected)
{
var obj = new Collection<object>
{
null,
null
};
var actual = obj.JsonSerialize();
Assert.Equal(expected, actual);
}
示例6: op_JsonSerialize_object_whenCollectionOfObject
public void op_JsonSerialize_object_whenCollectionOfObject(string expected)
{
var obj = new Collection<XmlNamespace>
{
new XmlNamespace("com", "http://example.com"),
new XmlNamespace("net", "http://example.net")
};
var actual = obj.JsonSerialize();
Assert.Equal(expected, actual);
}
示例7: op_JsonSerialize_object_whenCollectionOfByte
public void op_JsonSerialize_object_whenCollectionOfByte(string expected)
{
var obj = new Collection<byte>
{
1,
255
};
var actual = obj.JsonSerialize();
Assert.Equal(expected, actual);
}
示例8: op_JsonSerialize_object_whenCollectionOfInt64
public void op_JsonSerialize_object_whenCollectionOfInt64(string expected)
{
var obj = new Collection<long>
{
12345,
67890
};
var actual = obj.JsonSerialize();
Assert.Equal(expected, actual);
}
示例9: op_JsonSerialize_object_whenCollectionOfGuid
public void op_JsonSerialize_object_whenCollectionOfGuid(string expected)
{
var obj = new Collection<Guid>
{
XmlConvert.ToGuid("b75a9ea5-01ca-4a61-b299-8d0823a4a64a"),
XmlConvert.ToGuid("ce6a8e72-b5dc-4682-b9ce-23351d9d2f4a")
};
var actual = obj.JsonSerialize();
Assert.Equal(expected, actual);
}
示例10: op_JsonSerialize_object_whenCollectionOfDouble
public void op_JsonSerialize_object_whenCollectionOfDouble(string expected)
{
var obj = new Collection<double>
{
1.23d,
4.56d
};
var actual = obj.JsonSerialize();
Assert.Equal(expected, actual);
}
示例11: op_JsonSerialize_object_whenCollectionOfEnum
public void op_JsonSerialize_object_whenCollectionOfEnum(string expected)
{
var obj = new Collection<DayOfWeek>
{
DayOfWeek.Monday,
DayOfWeek.Friday
};
var actual = obj.JsonSerialize();
Assert.Equal(expected, actual);
}
示例12: op_JsonSerialize_object_whenCollectionOfDecimal
public void op_JsonSerialize_object_whenCollectionOfDecimal(string expected)
{
var obj = new Collection<decimal>
{
1.23m,
4.56m
};
var actual = obj.JsonSerialize();
Assert.Equal(expected, actual);
}
示例13: op_JsonSerialize_object_whenCollectionOfDateTimeOffset
public void op_JsonSerialize_object_whenCollectionOfDateTimeOffset(string expected)
{
var obj = new Collection<DateTimeOffset>
{
new DateTime(1999, 12, 31),
new DateTime(2000, 1, 1)
};
var actual = obj.JsonSerialize();
Assert.Equal(expected, actual);
}
示例14: op_JsonSerialize_object_whenCollectionOfChar
public void op_JsonSerialize_object_whenCollectionOfChar(string expected)
{
var obj = new Collection<char>
{
'a',
'z'
};
var actual = obj.JsonSerialize();
Assert.Equal(expected, actual);
}
示例15: op_JsonSerialize_object_whenCollectionOfTimeSpan
public void op_JsonSerialize_object_whenCollectionOfTimeSpan(string expected)
{
var obj = new Collection<TimeSpan>
{
new TimeSpan(1, 2, 3),
new TimeSpan(4, 5, 6)
};
var actual = obj.JsonSerialize();
Assert.Equal(expected, actual);
}