Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
b5ba93bf
Commit
b5ba93bf
authored
Jul 14, 2011
by
csharptest
Committed by
rogerk
Jul 14, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrated feedback from revision c97eeb8d933f
parent
84f7e09f
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
40 additions
and
43 deletions
+40
-43
unittest_extras_xmltest.proto
protos/extest/unittest_extras_xmltest.proto
+0
-2
BinaryCompatibilityTests.cs
...colBuffers.Test/Compatibility/BinaryCompatibilityTests.cs
+2
-2
CompatibilityTests.cs
src/ProtocolBuffers.Test/Compatibility/CompatibilityTests.cs
+14
-9
DictionaryCompatibilityTests.cs
...uffers.Test/Compatibility/DictionaryCompatibilityTests.cs
+2
-2
JsonCompatibilityTests.cs
...tocolBuffers.Test/Compatibility/JsonCompatibilityTests.cs
+2
-2
TestResources.Designer.cs
...tocolBuffers.Test/Compatibility/TestResources.Designer.cs
+3
-3
TestResources.resx
src/ProtocolBuffers.Test/Compatibility/TestResources.resx
+0
-0
TextCompatibilityTests.cs
...tocolBuffers.Test/Compatibility/TextCompatibilityTests.cs
+2
-2
XmlCompatibilityTests.cs
...otocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs
+2
-2
google_message1.dat
src/ProtocolBuffers.Test/Compatibility/google_message1.dat
+0
-0
google_message2.dat
src/ProtocolBuffers.Test/Compatibility/google_message2.dat
+0
-0
ProtocolBuffers.Test.csproj
src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj
+10
-10
ExtensionRegistryLite.cs
src/ProtocolBuffers/ExtensionRegistryLite.cs
+3
-9
No files found.
protos/extest/unittest_extras_xmltest.proto
View file @
b5ba93bf
// Additional options required for C# generation. File from copyright
// line onwards is as per original distribution.
import
"google/protobuf/csharp_options.proto"
;
import
"google/protobuf/csharp_options.proto"
;
option
(
google.protobuf.csharp_file_options
)
.
namespace
=
"Google.ProtocolBuffers.TestProtos"
;
option
(
google.protobuf.csharp_file_options
)
.
namespace
=
"Google.ProtocolBuffers.TestProtos"
;
option
(
google.protobuf.csharp_file_options
)
.
umbrella_classname
=
"UnitTestXmlSerializerTestProtoFile"
;
option
(
google.protobuf.csharp_file_options
)
.
umbrella_classname
=
"UnitTestXmlSerializerTestProtoFile"
;
...
...
src/ProtocolBuffers.Test/Compat
Tests
/BinaryCompatibilityTests.cs
→
src/ProtocolBuffers.Test/Compat
ibility
/BinaryCompatibilityTests.cs
View file @
b5ba93bf
using
System
;
using
System
;
using
NUnit.Framework
;
using
NUnit.Framework
;
namespace
Google.ProtocolBuffers.Compat
Tests
namespace
Google.ProtocolBuffers.Compat
ibility
{
{
[
TestFixture
]
[
TestFixture
]
public
class
BinaryCompatibilityTests
:
CompatibilityTests
public
class
BinaryCompatibilityTests
:
CompatibilityTests
...
@@ -12,7 +12,7 @@ namespace Google.ProtocolBuffers.CompatTests
...
@@ -12,7 +12,7 @@ namespace Google.ProtocolBuffers.CompatTests
return
bresult
;
return
bresult
;
}
}
protected
override
TBuilder
DeerializeMessage
<
TMessage
,
TBuilder
>(
object
message
,
TBuilder
builder
,
ExtensionRegistry
registry
)
protected
override
TBuilder
De
s
erializeMessage
<
TMessage
,
TBuilder
>(
object
message
,
TBuilder
builder
,
ExtensionRegistry
registry
)
{
{
return
builder
.
MergeFrom
((
byte
[])
message
,
registry
);
return
builder
.
MergeFrom
((
byte
[])
message
,
registry
);
}
}
...
...
src/ProtocolBuffers.Test/Compat
Tests
/CompatibilityTests.cs
→
src/ProtocolBuffers.Test/Compat
ibility
/CompatibilityTests.cs
View file @
b5ba93bf
...
@@ -2,15 +2,20 @@
...
@@ -2,15 +2,20 @@
using
Google.ProtocolBuffers.TestProtos
;
using
Google.ProtocolBuffers.TestProtos
;
using
NUnit.Framework
;
using
NUnit.Framework
;
namespace
Google.ProtocolBuffers.Compat
Tests
namespace
Google.ProtocolBuffers.Compat
ibility
{
{
/// <summary>
/// This abstract base implements several tests to ensure that well-known messages can be written
/// and read to/from various formats without loosing data. Implementations overload the two serailization
/// methods to provide the tests with the means to read and write for a given format.
/// </summary>
public
abstract
class
CompatibilityTests
public
abstract
class
CompatibilityTests
{
{
protected
abstract
object
SerializeMessage
<
TMessage
,
TBuilder
>(
TMessage
message
)
protected
abstract
object
SerializeMessage
<
TMessage
,
TBuilder
>(
TMessage
message
)
where
TMessage
:
IMessageLite
<
TMessage
,
TBuilder
>
where
TMessage
:
IMessageLite
<
TMessage
,
TBuilder
>
where
TBuilder
:
IBuilderLite
<
TMessage
,
TBuilder
>;
where
TBuilder
:
IBuilderLite
<
TMessage
,
TBuilder
>;
protected
abstract
TBuilder
DeerializeMessage
<
TMessage
,
TBuilder
>(
object
message
,
TBuilder
builder
,
ExtensionRegistry
registry
)
protected
abstract
TBuilder
De
s
erializeMessage
<
TMessage
,
TBuilder
>(
object
message
,
TBuilder
builder
,
ExtensionRegistry
registry
)
where
TMessage
:
IMessageLite
<
TMessage
,
TBuilder
>
where
TMessage
:
IMessageLite
<
TMessage
,
TBuilder
>
where
TBuilder
:
IBuilderLite
<
TMessage
,
TBuilder
>;
where
TBuilder
:
IBuilderLite
<
TMessage
,
TBuilder
>;
...
@@ -25,7 +30,7 @@ namespace Google.ProtocolBuffers.CompatTests
...
@@ -25,7 +30,7 @@ namespace Google.ProtocolBuffers.CompatTests
SizeMessage1
msg
=
SizeMessage1
.
CreateBuilder
().
MergeFrom
(
TestResources
.
google_message1
).
Build
();
SizeMessage1
msg
=
SizeMessage1
.
CreateBuilder
().
MergeFrom
(
TestResources
.
google_message1
).
Build
();
object
content
=
SerializeMessage
<
SizeMessage1
,
SizeMessage1
.
Builder
>(
msg
);
object
content
=
SerializeMessage
<
SizeMessage1
,
SizeMessage1
.
Builder
>(
msg
);
SizeMessage1
copy
=
DeerializeMessage
<
SizeMessage1
,
SizeMessage1
.
Builder
>(
content
,
SizeMessage1
.
CreateBuilder
(),
ExtensionRegistry
.
Empty
).
Build
();
SizeMessage1
copy
=
De
s
erializeMessage
<
SizeMessage1
,
SizeMessage1
.
Builder
>(
content
,
SizeMessage1
.
CreateBuilder
(),
ExtensionRegistry
.
Empty
).
Build
();
Assert
.
AreEqual
(
msg
,
copy
);
Assert
.
AreEqual
(
msg
,
copy
);
AssertOutputEquals
(
content
,
SerializeMessage
<
SizeMessage1
,
SizeMessage1
.
Builder
>(
copy
));
AssertOutputEquals
(
content
,
SerializeMessage
<
SizeMessage1
,
SizeMessage1
.
Builder
>(
copy
));
...
@@ -38,7 +43,7 @@ namespace Google.ProtocolBuffers.CompatTests
...
@@ -38,7 +43,7 @@ namespace Google.ProtocolBuffers.CompatTests
SizeMessage2
msg
=
SizeMessage2
.
CreateBuilder
().
MergeFrom
(
TestResources
.
google_message2
).
Build
();
SizeMessage2
msg
=
SizeMessage2
.
CreateBuilder
().
MergeFrom
(
TestResources
.
google_message2
).
Build
();
object
content
=
SerializeMessage
<
SizeMessage2
,
SizeMessage2
.
Builder
>(
msg
);
object
content
=
SerializeMessage
<
SizeMessage2
,
SizeMessage2
.
Builder
>(
msg
);
SizeMessage2
copy
=
DeerializeMessage
<
SizeMessage2
,
SizeMessage2
.
Builder
>(
content
,
SizeMessage2
.
CreateBuilder
(),
ExtensionRegistry
.
Empty
).
Build
();
SizeMessage2
copy
=
De
s
erializeMessage
<
SizeMessage2
,
SizeMessage2
.
Builder
>(
content
,
SizeMessage2
.
CreateBuilder
(),
ExtensionRegistry
.
Empty
).
Build
();
Assert
.
AreEqual
(
msg
,
copy
);
Assert
.
AreEqual
(
msg
,
copy
);
AssertOutputEquals
(
content
,
SerializeMessage
<
SizeMessage2
,
SizeMessage2
.
Builder
>(
copy
));
AssertOutputEquals
(
content
,
SerializeMessage
<
SizeMessage2
,
SizeMessage2
.
Builder
>(
copy
));
...
@@ -51,7 +56,7 @@ namespace Google.ProtocolBuffers.CompatTests
...
@@ -51,7 +56,7 @@ namespace Google.ProtocolBuffers.CompatTests
SpeedMessage1
msg
=
SpeedMessage1
.
CreateBuilder
().
MergeFrom
(
TestResources
.
google_message1
).
Build
();
SpeedMessage1
msg
=
SpeedMessage1
.
CreateBuilder
().
MergeFrom
(
TestResources
.
google_message1
).
Build
();
object
content
=
SerializeMessage
<
SpeedMessage1
,
SpeedMessage1
.
Builder
>(
msg
);
object
content
=
SerializeMessage
<
SpeedMessage1
,
SpeedMessage1
.
Builder
>(
msg
);
SpeedMessage1
copy
=
DeerializeMessage
<
SpeedMessage1
,
SpeedMessage1
.
Builder
>(
content
,
SpeedMessage1
.
CreateBuilder
(),
ExtensionRegistry
.
Empty
).
Build
();
SpeedMessage1
copy
=
De
s
erializeMessage
<
SpeedMessage1
,
SpeedMessage1
.
Builder
>(
content
,
SpeedMessage1
.
CreateBuilder
(),
ExtensionRegistry
.
Empty
).
Build
();
Assert
.
AreEqual
(
msg
,
copy
);
Assert
.
AreEqual
(
msg
,
copy
);
AssertOutputEquals
(
content
,
SerializeMessage
<
SpeedMessage1
,
SpeedMessage1
.
Builder
>(
copy
));
AssertOutputEquals
(
content
,
SerializeMessage
<
SpeedMessage1
,
SpeedMessage1
.
Builder
>(
copy
));
...
@@ -64,7 +69,7 @@ namespace Google.ProtocolBuffers.CompatTests
...
@@ -64,7 +69,7 @@ namespace Google.ProtocolBuffers.CompatTests
SpeedMessage2
msg
=
SpeedMessage2
.
CreateBuilder
().
MergeFrom
(
TestResources
.
google_message2
).
Build
();
SpeedMessage2
msg
=
SpeedMessage2
.
CreateBuilder
().
MergeFrom
(
TestResources
.
google_message2
).
Build
();
object
content
=
SerializeMessage
<
SpeedMessage2
,
SpeedMessage2
.
Builder
>(
msg
);
object
content
=
SerializeMessage
<
SpeedMessage2
,
SpeedMessage2
.
Builder
>(
msg
);
SpeedMessage2
copy
=
DeerializeMessage
<
SpeedMessage2
,
SpeedMessage2
.
Builder
>(
content
,
SpeedMessage2
.
CreateBuilder
(),
ExtensionRegistry
.
Empty
).
Build
();
SpeedMessage2
copy
=
De
s
erializeMessage
<
SpeedMessage2
,
SpeedMessage2
.
Builder
>(
content
,
SpeedMessage2
.
CreateBuilder
(),
ExtensionRegistry
.
Empty
).
Build
();
Assert
.
AreEqual
(
msg
,
copy
);
Assert
.
AreEqual
(
msg
,
copy
);
AssertOutputEquals
(
content
,
SerializeMessage
<
SpeedMessage2
,
SpeedMessage2
.
Builder
>(
copy
));
AssertOutputEquals
(
content
,
SerializeMessage
<
SpeedMessage2
,
SpeedMessage2
.
Builder
>(
copy
));
...
@@ -151,7 +156,7 @@ namespace Google.ProtocolBuffers.CompatTests
...
@@ -151,7 +156,7 @@ namespace Google.ProtocolBuffers.CompatTests
TestAllTypes
msg
=
AddAllTypes
(
new
TestAllTypes
.
Builder
()).
Build
();
TestAllTypes
msg
=
AddAllTypes
(
new
TestAllTypes
.
Builder
()).
Build
();
object
content
=
SerializeMessage
<
TestAllTypes
,
TestAllTypes
.
Builder
>(
msg
);
object
content
=
SerializeMessage
<
TestAllTypes
,
TestAllTypes
.
Builder
>(
msg
);
TestAllTypes
copy
=
DeerializeMessage
<
TestAllTypes
,
TestAllTypes
.
Builder
>(
content
,
TestAllTypes
.
CreateBuilder
(),
ExtensionRegistry
.
Empty
).
Build
();
TestAllTypes
copy
=
De
s
erializeMessage
<
TestAllTypes
,
TestAllTypes
.
Builder
>(
content
,
TestAllTypes
.
CreateBuilder
(),
ExtensionRegistry
.
Empty
).
Build
();
Assert
.
AreEqual
(
msg
,
copy
);
Assert
.
AreEqual
(
msg
,
copy
);
AssertOutputEquals
(
content
,
SerializeMessage
<
TestAllTypes
,
TestAllTypes
.
Builder
>(
copy
));
AssertOutputEquals
(
content
,
SerializeMessage
<
TestAllTypes
,
TestAllTypes
.
Builder
>(
copy
));
...
@@ -164,7 +169,7 @@ namespace Google.ProtocolBuffers.CompatTests
...
@@ -164,7 +169,7 @@ namespace Google.ProtocolBuffers.CompatTests
TestAllTypes
msg
=
AddRepeatedTypes
(
new
TestAllTypes
.
Builder
(),
5
).
Build
();
TestAllTypes
msg
=
AddRepeatedTypes
(
new
TestAllTypes
.
Builder
(),
5
).
Build
();
object
content
=
SerializeMessage
<
TestAllTypes
,
TestAllTypes
.
Builder
>(
msg
);
object
content
=
SerializeMessage
<
TestAllTypes
,
TestAllTypes
.
Builder
>(
msg
);
TestAllTypes
copy
=
DeerializeMessage
<
TestAllTypes
,
TestAllTypes
.
Builder
>(
content
,
TestAllTypes
.
CreateBuilder
(),
ExtensionRegistry
.
Empty
).
Build
();
TestAllTypes
copy
=
De
s
erializeMessage
<
TestAllTypes
,
TestAllTypes
.
Builder
>(
content
,
TestAllTypes
.
CreateBuilder
(),
ExtensionRegistry
.
Empty
).
Build
();
Assert
.
AreEqual
(
msg
,
copy
);
Assert
.
AreEqual
(
msg
,
copy
);
AssertOutputEquals
(
content
,
SerializeMessage
<
TestAllTypes
,
TestAllTypes
.
Builder
>(
copy
));
AssertOutputEquals
(
content
,
SerializeMessage
<
TestAllTypes
,
TestAllTypes
.
Builder
>(
copy
));
...
@@ -177,7 +182,7 @@ namespace Google.ProtocolBuffers.CompatTests
...
@@ -177,7 +182,7 @@ namespace Google.ProtocolBuffers.CompatTests
TestPackedTypes
msg
=
AddPackedTypes
(
new
TestPackedTypes
.
Builder
(),
5
).
Build
();
TestPackedTypes
msg
=
AddPackedTypes
(
new
TestPackedTypes
.
Builder
(),
5
).
Build
();
object
content
=
SerializeMessage
<
TestPackedTypes
,
TestPackedTypes
.
Builder
>(
msg
);
object
content
=
SerializeMessage
<
TestPackedTypes
,
TestPackedTypes
.
Builder
>(
msg
);
TestPackedTypes
copy
=
DeerializeMessage
<
TestPackedTypes
,
TestPackedTypes
.
Builder
>(
content
,
TestPackedTypes
.
CreateBuilder
(),
ExtensionRegistry
.
Empty
).
Build
();
TestPackedTypes
copy
=
De
s
erializeMessage
<
TestPackedTypes
,
TestPackedTypes
.
Builder
>(
content
,
TestPackedTypes
.
CreateBuilder
(),
ExtensionRegistry
.
Empty
).
Build
();
Assert
.
AreEqual
(
msg
,
copy
);
Assert
.
AreEqual
(
msg
,
copy
);
AssertOutputEquals
(
content
,
SerializeMessage
<
TestPackedTypes
,
TestPackedTypes
.
Builder
>(
copy
));
AssertOutputEquals
(
content
,
SerializeMessage
<
TestPackedTypes
,
TestPackedTypes
.
Builder
>(
copy
));
...
...
src/ProtocolBuffers.Test/Compat
Tests
/DictionaryCompatibilityTests.cs
→
src/ProtocolBuffers.Test/Compat
ibility
/DictionaryCompatibilityTests.cs
View file @
b5ba93bf
...
@@ -5,7 +5,7 @@ using System.Text;
...
@@ -5,7 +5,7 @@ using System.Text;
using
Google.ProtocolBuffers.Serialization
;
using
Google.ProtocolBuffers.Serialization
;
using
NUnit.Framework
;
using
NUnit.Framework
;
namespace
Google.ProtocolBuffers.Compat
Tests
namespace
Google.ProtocolBuffers.Compat
ibility
{
{
[
TestFixture
]
[
TestFixture
]
public
class
DictionaryCompatibilityTests
:
CompatibilityTests
public
class
DictionaryCompatibilityTests
:
CompatibilityTests
...
@@ -17,7 +17,7 @@ namespace Google.ProtocolBuffers.CompatTests
...
@@ -17,7 +17,7 @@ namespace Google.ProtocolBuffers.CompatTests
return
writer
.
ToDictionary
();
return
writer
.
ToDictionary
();
}
}
protected
override
TBuilder
DeerializeMessage
<
TMessage
,
TBuilder
>(
object
message
,
TBuilder
builder
,
ExtensionRegistry
registry
)
protected
override
TBuilder
De
s
erializeMessage
<
TMessage
,
TBuilder
>(
object
message
,
TBuilder
builder
,
ExtensionRegistry
registry
)
{
{
new
DictionaryReader
((
IDictionary
<
string
,
object
>)
message
).
Merge
(
builder
);
new
DictionaryReader
((
IDictionary
<
string
,
object
>)
message
).
Merge
(
builder
);
return
builder
;
return
builder
;
...
...
src/ProtocolBuffers.Test/Compat
Tests
/JsonCompatibilityTests.cs
→
src/ProtocolBuffers.Test/Compat
ibility
/JsonCompatibilityTests.cs
View file @
b5ba93bf
...
@@ -3,7 +3,7 @@ using System.Text;
...
@@ -3,7 +3,7 @@ using System.Text;
using
Google.ProtocolBuffers.Serialization
;
using
Google.ProtocolBuffers.Serialization
;
using
NUnit.Framework
;
using
NUnit.Framework
;
namespace
Google.ProtocolBuffers.Compat
Tests
namespace
Google.ProtocolBuffers.Compat
ibility
{
{
[
TestFixture
]
[
TestFixture
]
public
class
JsonCompatibilityTests
:
CompatibilityTests
public
class
JsonCompatibilityTests
:
CompatibilityTests
...
@@ -17,7 +17,7 @@ namespace Google.ProtocolBuffers.CompatTests
...
@@ -17,7 +17,7 @@ namespace Google.ProtocolBuffers.CompatTests
return
sw
.
ToString
();
return
sw
.
ToString
();
}
}
protected
override
TBuilder
DeerializeMessage
<
TMessage
,
TBuilder
>(
object
message
,
TBuilder
builder
,
ExtensionRegistry
registry
)
protected
override
TBuilder
De
s
erializeMessage
<
TMessage
,
TBuilder
>(
object
message
,
TBuilder
builder
,
ExtensionRegistry
registry
)
{
{
JsonFormatReader
.
CreateInstance
((
string
)
message
).
Merge
(
builder
);
JsonFormatReader
.
CreateInstance
((
string
)
message
).
Merge
(
builder
);
return
builder
;
return
builder
;
...
...
src/ProtocolBuffers.Test/Compat
Tests
/TestResources.Designer.cs
→
src/ProtocolBuffers.Test/Compat
ibility
/TestResources.Designer.cs
View file @
b5ba93bf
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// <auto-generated>
// <auto-generated>
// This code was generated by a tool.
// This code was generated by a tool.
// Runtime Version:2.0.50727.544
4
// Runtime Version:2.0.50727.544
6
//
//
// Changes to this file may cause incorrect behavior and will be lost if
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// the code is regenerated.
// </auto-generated>
// </auto-generated>
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
namespace
Google.ProtocolBuffers.Compat
Tests
{
namespace
Google.ProtocolBuffers.Compat
ibility
{
using
System
;
using
System
;
...
@@ -39,7 +39,7 @@ namespace Google.ProtocolBuffers.CompatTests {
...
@@ -39,7 +39,7 @@ namespace Google.ProtocolBuffers.CompatTests {
internal
static
global
::
System
.
Resources
.
ResourceManager
ResourceManager
{
internal
static
global
::
System
.
Resources
.
ResourceManager
ResourceManager
{
get
{
get
{
if
(
object
.
ReferenceEquals
(
resourceMan
,
null
))
{
if
(
object
.
ReferenceEquals
(
resourceMan
,
null
))
{
global
::
System
.
Resources
.
ResourceManager
temp
=
new
global
::
System
.
Resources
.
ResourceManager
(
"Google.ProtocolBuffers.Compat
Tests
.TestResources"
,
typeof
(
TestResources
).
Assembly
);
global
::
System
.
Resources
.
ResourceManager
temp
=
new
global
::
System
.
Resources
.
ResourceManager
(
"Google.ProtocolBuffers.Compat
ibility
.TestResources"
,
typeof
(
TestResources
).
Assembly
);
resourceMan
=
temp
;
resourceMan
=
temp
;
}
}
return
resourceMan
;
return
resourceMan
;
...
...
src/ProtocolBuffers.Test/Compat
Tests
/TestResources.resx
→
src/ProtocolBuffers.Test/Compat
ibility
/TestResources.resx
View file @
b5ba93bf
File moved
src/ProtocolBuffers.Test/Compat
Tests
/TextCompatibilityTests.cs
→
src/ProtocolBuffers.Test/Compat
ibility
/TextCompatibilityTests.cs
View file @
b5ba93bf
...
@@ -2,7 +2,7 @@ using System.ComponentModel;
...
@@ -2,7 +2,7 @@ using System.ComponentModel;
using
System.IO
;
using
System.IO
;
using
NUnit.Framework
;
using
NUnit.Framework
;
namespace
Google.ProtocolBuffers.Compat
Tests
namespace
Google.ProtocolBuffers.Compat
ibility
{
{
[
TestFixture
]
[
TestFixture
]
public
class
TextCompatibilityTests
:
CompatibilityTests
public
class
TextCompatibilityTests
:
CompatibilityTests
...
@@ -14,7 +14,7 @@ namespace Google.ProtocolBuffers.CompatTests
...
@@ -14,7 +14,7 @@ namespace Google.ProtocolBuffers.CompatTests
return
text
.
ToString
();
return
text
.
ToString
();
}
}
protected
override
TBuilder
DeerializeMessage
<
TMessage
,
TBuilder
>(
object
message
,
TBuilder
builder
,
ExtensionRegistry
registry
)
protected
override
TBuilder
De
s
erializeMessage
<
TMessage
,
TBuilder
>(
object
message
,
TBuilder
builder
,
ExtensionRegistry
registry
)
{
{
TextFormat
.
Merge
(
new
StringReader
((
string
)
message
),
registry
,
(
IBuilder
)
builder
);
TextFormat
.
Merge
(
new
StringReader
((
string
)
message
),
registry
,
(
IBuilder
)
builder
);
return
builder
;
return
builder
;
...
...
src/ProtocolBuffers.Test/Compat
Tests
/XmlCompatibilityTests.cs
→
src/ProtocolBuffers.Test/Compat
ibility
/XmlCompatibilityTests.cs
View file @
b5ba93bf
...
@@ -3,7 +3,7 @@ using Google.ProtocolBuffers.Serialization;
...
@@ -3,7 +3,7 @@ using Google.ProtocolBuffers.Serialization;
using
Google.ProtocolBuffers.TestProtos
;
using
Google.ProtocolBuffers.TestProtos
;
using
NUnit.Framework
;
using
NUnit.Framework
;
namespace
Google.ProtocolBuffers.Compat
Tests
namespace
Google.ProtocolBuffers.Compat
ibility
{
{
[
TestFixture
]
[
TestFixture
]
public
class
XmlCompatibilityTests
:
CompatibilityTests
public
class
XmlCompatibilityTests
:
CompatibilityTests
...
@@ -16,7 +16,7 @@ namespace Google.ProtocolBuffers.CompatTests
...
@@ -16,7 +16,7 @@ namespace Google.ProtocolBuffers.CompatTests
return
text
.
ToString
();
return
text
.
ToString
();
}
}
protected
override
TBuilder
DeerializeMessage
<
TMessage
,
TBuilder
>(
object
message
,
TBuilder
builder
,
ExtensionRegistry
registry
)
protected
override
TBuilder
De
s
erializeMessage
<
TMessage
,
TBuilder
>(
object
message
,
TBuilder
builder
,
ExtensionRegistry
registry
)
{
{
XmlFormatReader
reader
=
XmlFormatReader
.
CreateInstance
((
string
)
message
);
XmlFormatReader
reader
=
XmlFormatReader
.
CreateInstance
((
string
)
message
);
return
reader
.
Merge
(
"root"
,
builder
,
registry
);
return
reader
.
Merge
(
"root"
,
builder
,
registry
);
...
...
src/ProtocolBuffers.Test/Compat
Tests
/google_message1.dat
→
src/ProtocolBuffers.Test/Compat
ibility
/google_message1.dat
View file @
b5ba93bf
File moved
src/ProtocolBuffers.Test/Compat
Tests
/google_message2.dat
→
src/ProtocolBuffers.Test/Compat
ibility
/google_message2.dat
View file @
b5ba93bf
File moved
src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj
View file @
b5ba93bf
...
@@ -75,17 +75,17 @@
...
@@ -75,17 +75,17 @@
<Compile
Include=
"CodedInputStreamTest.cs"
/>
<Compile
Include=
"CodedInputStreamTest.cs"
/>
<Compile
Include=
"CodedOutputStreamTest.cs"
/>
<Compile
Include=
"CodedOutputStreamTest.cs"
/>
<Compile
Include=
"Collections\PopsicleListTest.cs"
/>
<Compile
Include=
"Collections\PopsicleListTest.cs"
/>
<Compile
Include=
"Compat
Tests
\BinaryCompatibilityTests.cs"
/>
<Compile
Include=
"Compat
ibility
\BinaryCompatibilityTests.cs"
/>
<Compile
Include=
"Compat
Tests
\CompatibilityTests.cs"
/>
<Compile
Include=
"Compat
ibility
\CompatibilityTests.cs"
/>
<Compile
Include=
"Compat
Tests
\DictionaryCompatibilityTests.cs"
/>
<Compile
Include=
"Compat
ibility
\DictionaryCompatibilityTests.cs"
/>
<Compile
Include=
"Compat
Tests
\JsonCompatibilityTests.cs"
/>
<Compile
Include=
"Compat
ibility
\JsonCompatibilityTests.cs"
/>
<Compile
Include=
"Compat
Tests
\TestResources.Designer.cs"
>
<Compile
Include=
"Compat
ibility
\TestResources.Designer.cs"
>
<AutoGen>
True
</AutoGen>
<AutoGen>
True
</AutoGen>
<DesignTime>
True
</DesignTime>
<DesignTime>
True
</DesignTime>
<DependentUpon>
TestResources.resx
</DependentUpon>
<DependentUpon>
TestResources.resx
</DependentUpon>
</Compile>
</Compile>
<Compile
Include=
"Compat
Tests
\TextCompatibilityTests.cs"
/>
<Compile
Include=
"Compat
ibility
\TextCompatibilityTests.cs"
/>
<Compile
Include=
"Compat
Tests
\XmlCompatibilityTests.cs"
/>
<Compile
Include=
"Compat
ibility
\XmlCompatibilityTests.cs"
/>
<Compile
Include=
"CSharpOptionsTest.cs"
/>
<Compile
Include=
"CSharpOptionsTest.cs"
/>
<Compile
Include=
"DescriptorsTest.cs"
/>
<Compile
Include=
"DescriptorsTest.cs"
/>
<Compile
Include=
"Descriptors\MessageDescriptorTest.cs"
/>
<Compile
Include=
"Descriptors\MessageDescriptorTest.cs"
/>
...
@@ -147,11 +147,11 @@
...
@@ -147,11 +147,11 @@
</BootstrapperPackage>
</BootstrapperPackage>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<None
Include=
"Compat
Tests
\google_message1.dat"
/>
<None
Include=
"Compat
ibility
\google_message1.dat"
/>
<None
Include=
"Compat
Tests
\google_message2.dat"
/>
<None
Include=
"Compat
ibility
\google_message2.dat"
/>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<EmbeddedResource
Include=
"Compat
Tests
\TestResources.resx"
>
<EmbeddedResource
Include=
"Compat
ibility
\TestResources.resx"
>
<Generator>
ResXFileCodeGenerator
</Generator>
<Generator>
ResXFileCodeGenerator
</Generator>
<LastGenOutput>
TestResources.Designer.cs
</LastGenOutput>
<LastGenOutput>
TestResources.Designer.cs
</LastGenOutput>
</EmbeddedResource>
</EmbeddedResource>
...
...
src/ProtocolBuffers/ExtensionRegistryLite.cs
View file @
b5ba93bf
...
@@ -36,6 +36,8 @@
...
@@ -36,6 +36,8 @@
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
ExtensionByNameMap
=
System
.
Collections
.
Generic
.
Dictionary
<
object
,
System
.
Collections
.
Generic
.
Dictionary
<
string
,
Google
.
ProtocolBuffers
.
IGeneratedExtensionLite
>>;
using
ExtensionByIdMap
=
System
.
Collections
.
Generic
.
Dictionary
<
Google
.
ProtocolBuffers
.
ExtensionRegistry
.
ExtensionIntPair
,
Google
.
ProtocolBuffers
.
IGeneratedExtensionLite
>;
namespace
Google.ProtocolBuffers
namespace
Google.ProtocolBuffers
{
{
...
@@ -92,14 +94,6 @@ namespace Google.ProtocolBuffers
...
@@ -92,14 +94,6 @@ namespace Google.ProtocolBuffers
/// </remarks>
/// </remarks>
public
sealed
partial
class
ExtensionRegistry
public
sealed
partial
class
ExtensionRegistry
{
{
private
class
ExtensionByNameMap
:
Dictionary
<
object
,
Dictionary
<
string
,
IGeneratedExtensionLite
>>
{
}
private
class
ExtensionByIdMap
:
Dictionary
<
ExtensionIntPair
,
IGeneratedExtensionLite
>
{
}
private
static
readonly
ExtensionRegistry
empty
=
new
ExtensionRegistry
(
private
static
readonly
ExtensionRegistry
empty
=
new
ExtensionRegistry
(
new
ExtensionByNameMap
(),
new
ExtensionByNameMap
(),
new
ExtensionByIdMap
(),
new
ExtensionByIdMap
(),
...
@@ -192,7 +186,7 @@ namespace Google.ProtocolBuffers
...
@@ -192,7 +186,7 @@ namespace Google.ProtocolBuffers
/// Nested type just used to represent a pair of MessageDescriptor and int, as
/// Nested type just used to represent a pair of MessageDescriptor and int, as
/// the key into the "by number" map.
/// the key into the "by number" map.
/// </summary>
/// </summary>
private
struct
ExtensionIntPair
:
IEquatable
<
ExtensionIntPair
>
internal
struct
ExtensionIntPair
:
IEquatable
<
ExtensionIntPair
>
{
{
private
readonly
object
msgType
;
private
readonly
object
msgType
;
private
readonly
int
number
;
private
readonly
int
number
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment