-Formatting
-Build
This commit is contained in:
@@ -29,6 +29,7 @@ using System.Collections;
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(NET35 || NET20)
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
#if !(NET35 || NET20)
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public class Component
|
||||
{
|
||||
[JsonIgnore] // Ignore circular reference
|
||||
|
||||
@@ -49,7 +49,9 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
|
||||
string converter = (string)j[0];
|
||||
if (converter != ConverterType)
|
||||
{
|
||||
throw new Exception(StringUtils.FormatWith("Serialize converter {0} and deserialize converter {1} do not match.", CultureInfo.InvariantCulture, converter, ConverterType));
|
||||
}
|
||||
|
||||
string testValue = (string)j[1];
|
||||
return new ConverterPrecedenceClass(testValue);
|
||||
|
||||
@@ -170,4 +170,5 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -77,10 +77,16 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
_summary = summary;
|
||||
_time = DateTime.Now;
|
||||
|
||||
if (_userId == 0) _userId = GetCurrentUserId();
|
||||
if (_userId == 0)
|
||||
{
|
||||
_userId = GetCurrentUserId();
|
||||
}
|
||||
//This call only works at top level for now.
|
||||
//If _stackTrace = Nothing Then _stackTrace = Environment.StackTrace
|
||||
if (_sublocation == null) _sublocation = GetCurrentSubLocation();
|
||||
if (_sublocation == null)
|
||||
{
|
||||
_sublocation = GetCurrentSubLocation();
|
||||
}
|
||||
}
|
||||
|
||||
public Event(string sublocation, int userId, EventType type, string summary, string details, string stackTrace, string tag)
|
||||
@@ -94,9 +100,15 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
_tag = tag;
|
||||
_time = DateTime.Now;
|
||||
|
||||
if (_userId == 0) _userId = GetCurrentUserId();
|
||||
if (_userId == 0)
|
||||
{
|
||||
_userId = GetCurrentUserId();
|
||||
}
|
||||
//If _stackTrace = Nothing Then _stackTrace = Environment.StackTrace
|
||||
if (_sublocation == null) _sublocation = GetCurrentSubLocation();
|
||||
if (_sublocation == null)
|
||||
{
|
||||
_sublocation = GetCurrentSubLocation();
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
||||
@@ -46,4 +46,5 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -50,10 +50,10 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
internal class MyInterfaceConverter : TypeConverter
|
||||
{
|
||||
private readonly List<IMyInterface> _writers = new List<IMyInterface>
|
||||
{
|
||||
new ConsoleWriter(),
|
||||
new TraceWriter()
|
||||
};
|
||||
{
|
||||
new ConsoleWriter(),
|
||||
new TraceWriter()
|
||||
};
|
||||
|
||||
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
|
||||
{
|
||||
@@ -68,7 +68,9 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (from w in _writers where w.Name == value.ToString() select w).FirstOrDefault();
|
||||
}
|
||||
@@ -77,7 +79,9 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
Type destinationType)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return ((IMyInterface)value).Name;
|
||||
}
|
||||
}
|
||||
@@ -130,11 +134,11 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
|
||||
return
|
||||
(from c in converters
|
||||
let converter =
|
||||
(TypeConverter)Activator.CreateInstance(Type.GetType(((TypeConverterAttribute)c).ConverterTypeName))
|
||||
where converter.CanConvertFrom(typeof(string))
|
||||
&& converter.CanConvertTo(typeof(string))
|
||||
select converter)
|
||||
let converter =
|
||||
(TypeConverter)Activator.CreateInstance(Type.GetType(((TypeConverterAttribute)c).ConverterTypeName))
|
||||
where converter.CanConvertFrom(typeof(string))
|
||||
&& converter.CanConvertTo(typeof(string))
|
||||
select converter)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,9 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
get
|
||||
{
|
||||
if (_throwError != null)
|
||||
{
|
||||
return _throwError;
|
||||
}
|
||||
|
||||
throw new Exception("ListErrorObject.ThrowError get error!");
|
||||
}
|
||||
|
||||
@@ -43,7 +43,9 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
string s = (string)reader.Value;
|
||||
if (s == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || DNXCORE50)
|
||||
return s.ToLower(CultureInfo.InvariantCulture).Trim(new[] { ':' });
|
||||
|
||||
@@ -42,7 +42,9 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
get
|
||||
{
|
||||
if (_roles == null)
|
||||
{
|
||||
throw new Exception("Roles not loaded!");
|
||||
}
|
||||
|
||||
return _roles;
|
||||
}
|
||||
|
||||
+4
@@ -39,9 +39,13 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
NameContainer nameContainer = value as NameContainer;
|
||||
|
||||
if (nameContainer != null)
|
||||
{
|
||||
writer.WriteValue(nameContainer.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteNull();
|
||||
}
|
||||
}
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
|
||||
@@ -140,7 +140,6 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Serializable, DebuggerDisplay("{__DebugDisplay(),nq}")]
|
||||
public class Prism : Shape
|
||||
{
|
||||
@@ -224,4 +223,5 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,21 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema id="SqlTypesDataSet" targetNamespace="http://tempuri.org/SqlTypesDataSet.xsd" xmlns:mstns="http://tempuri.org/SqlTypesDataSet.xsd" xmlns="http://tempuri.org/SqlTypesDataSet.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
|
||||
|
||||
<xs:schema id="SqlTypesDataSet" targetNamespace="http://tempuri.org/SqlTypesDataSet.xsd"
|
||||
xmlns:mstns="http://tempuri.org/SqlTypesDataSet.xsd" xmlns="http://tempuri.org/SqlTypesDataSet.xsd"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
|
||||
xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified"
|
||||
elementFormDefault="qualified">
|
||||
<xs:annotation>
|
||||
<xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter"
|
||||
Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema"
|
||||
xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<Connections />
|
||||
<Tables />
|
||||
<Sources />
|
||||
</DataSource>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
<xs:element name="SqlTypesDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="SqlTypesDataSet" msprop:Generator_UserDSName="SqlTypesDataSet">
|
||||
<xs:element name="SqlTypesDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true"
|
||||
msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="SqlTypesDataSet"
|
||||
msprop:Generator_UserDSName="SqlTypesDataSet">
|
||||
<xs:complexType>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="TestTable" msprop:Generator_TableClassName="TestTableDataTable" msprop:Generator_TableVarName="tableTestTable" msprop:Generator_TablePropName="TestTable" msprop:Generator_RowDeletingName="TestTableRowDeleting" msprop:Generator_RowChangingName="TestTableRowChanging" msprop:Generator_RowEvHandlerName="TestTableRowChangeEventHandler" msprop:Generator_RowDeletedName="TestTableRowDeleted" msprop:Generator_UserTableName="TestTable" msprop:Generator_RowChangedName="TestTableRowChanged" msprop:Generator_RowEvArgName="TestTableRowChangeEvent" msprop:Generator_RowClassName="TestTableRow">
|
||||
<xs:element name="TestTable" msprop:Generator_TableClassName="TestTableDataTable"
|
||||
msprop:Generator_TableVarName="tableTestTable" msprop:Generator_TablePropName="TestTable"
|
||||
msprop:Generator_RowDeletingName="TestTableRowDeleting"
|
||||
msprop:Generator_RowChangingName="TestTableRowChanging"
|
||||
msprop:Generator_RowEvHandlerName="TestTableRowChangeEventHandler"
|
||||
msprop:Generator_RowDeletedName="TestTableRowDeleted" msprop:Generator_UserTableName="TestTable"
|
||||
msprop:Generator_RowChangedName="TestTableRowChanged"
|
||||
msprop:Generator_RowEvArgName="TestTableRowChangeEvent"
|
||||
msprop:Generator_RowClassName="TestTableRow">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="DateTimeValue" msdata:DataType="System.Data.SqlTypes.SqlDateTime" msprop:Generator_ColumnVarNameInTable="columnDateTimeValue" msprop:Generator_ColumnPropNameInRow="DateTimeValue" msprop:Generator_ColumnPropNameInTable="DateTimeValueColumn" msprop:Generator_UserColumnName="DateTimeValue" type="xs:dateTime" minOccurs="0" />
|
||||
<xs:element name="DateTimeValue" msdata:DataType="System.Data.SqlTypes.SqlDateTime"
|
||||
msprop:Generator_ColumnVarNameInTable="columnDateTimeValue"
|
||||
msprop:Generator_ColumnPropNameInRow="DateTimeValue"
|
||||
msprop:Generator_ColumnPropNameInTable="DateTimeValueColumn"
|
||||
msprop:Generator_UserColumnName="DateTimeValue" type="xs:dateTime" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
@@ -59,7 +59,9 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
for (int i = 0; i < Count; i++)
|
||||
{
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
throw new Exception("Index even: " + i);
|
||||
}
|
||||
|
||||
yield return this[i];
|
||||
}
|
||||
|
||||
@@ -43,7 +43,9 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
if (reader.TokenType == JsonToken.Null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new WidgetId1 { Value = int.Parse(reader.Value.ToString()) };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user