Skip to content

Commit

Permalink
Incomplete attempt to integrate endpoint-behaviour
Browse files Browse the repository at this point in the history
git-svn-id: http://protobuf-net.googlecode.com/svn/trunk@273 b72047a4-3652-0410-9617-b3994939e97b
  • Loading branch information
marc.gravell committed Oct 8, 2009
1 parent 0bd09d9 commit b16ec9b
Show file tree
Hide file tree
Showing 31 changed files with 1,597 additions and 931 deletions.
12 changes: 12 additions & 0 deletions Examples/Examples.csproj
Expand Up @@ -141,6 +141,8 @@
<Compile Include="Issues\Issue48.cs" />
<Compile Include="Issues\Issue54.cs" />
<Compile Include="Issues\Issue62.cs" />
<Compile Include="Issues\Issue70.cs">
</Compile>
<Compile Include="ItemsWithLengthPrefix.cs" />
<Compile Include="ListAsInterfaceTests.cs" />
<Compile Include="ListTests.cs" />
Expand Down Expand Up @@ -169,6 +171,12 @@
<Compile Include="ProtoGen\InputLoader.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>
<Compile Include="ProtoGen\NewTest.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>NewTest.proto</DependentUpon>
</Compile>
<Compile Include="ProtoGen\OptionParser.cs" />
<Compile Include="ProtoGen\searchRequest.cs">
<AutoGen>True</AutoGen>
Expand Down Expand Up @@ -289,6 +297,10 @@
<None Include="ProtoGen\Empty.proto">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ProtoGen\NewTest.proto">
<Generator>ProtoBufTool</Generator>
<LastGenOutput>NewTest.cs</LastGenOutput>
</None>
<None Include="ProtoGen\searchRequest.proto">
<CustomToolNamespace>%3bfixCase%3bdatacontract</CustomToolNamespace>
<Generator>ProtoBufTool</Generator>
Expand Down
60 changes: 60 additions & 0 deletions Examples/Issues/Issue70.cs
@@ -0,0 +1,60 @@
using NUnit.Framework;
using ProtoBuf;
using System.IO;

namespace Examples.Issues
{
[TestFixture, Ignore("not sure we want to support this")]
public class Issue70 {

[ProtoContract]
public class Strange // test entity
{
[ProtoMember(1)]
public string Foo { get; set; } // test prop
[ProtoMember(2)]
public int Bar { get; set; } // test prop
}

[Test]
public void SerializaeWithLengthPrefixShouldWorkWithBase128()
{
var original = new Strange { Foo = "abc", Bar = 123 };
// serialize and deserialize with base-128
using (MemoryStream ms = new MemoryStream())
{
Serializer.SerializeWithLengthPrefix(ms, original, PrefixStyle.Base128, 1);
ms.Position = 0;
object obj;
Serializer.NonGeneric.TryDeserializeWithLengthPrefix(ms,
PrefixStyle.Base128, i => typeof(Strange), out obj);
var clone = (Strange)obj;
Assert.AreNotSame(original, clone);
Assert.IsNotNull(clone);
Assert.AreEqual(original.Foo, clone.Foo, "Foo");
Assert.AreEqual(original.Bar, clone.Bar, "Bar");
}
}
[Test]
public void SerializaeWithLengthPrefixShouldWorkWithFixed32()
{
var original = new Strange { Foo = "abc", Bar = 123 };
// serialize and deserialize with fixed-32
using (MemoryStream ms = new MemoryStream())
{
Serializer.SerializeWithLengthPrefix(ms, original, PrefixStyle.Fixed32, 1);
ms.Position = 0;
object obj;
// BOOM here; oh how embarrassing
Serializer.NonGeneric.TryDeserializeWithLengthPrefix(ms,
PrefixStyle.Fixed32, i => typeof(Strange), out obj);
var clone = (Strange)obj;
Assert.AreNotSame(original, clone);
Assert.IsNotNull(clone);
Assert.AreEqual(original.Foo, clone.Foo, "Foo");
Assert.AreEqual(original.Bar, clone.Bar, "Bar");
}
}

}
}
4 changes: 2 additions & 2 deletions Proto.sln
Expand Up @@ -5,7 +5,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Examples", "Examples\Exampl
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "protobuf-net", "protobuf-net\protobuf-net.csproj", "{8374E4D7-2A91-48F1-9360-09B09CF27C3F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "protobuf-net_Silverlight", "protobuf-net_Silverlight\protobuf-net_Silverlight.csproj", "{35032FC5-65E0-4FE4-8DBC-A31F0694EC14}"
Project("{00000000-0000-0000-0000-000000000000}") = "protobuf-net_Silverlight", "protobuf-net_Silverlight\protobuf-net_Silverlight.csproj", "{35032FC5-65E0-4FE4-8DBC-A31F0694EC14}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SilverlightExtended", "SilverlightExtended\SilverlightExtended.csproj", "{05A18144-D234-46D7-A36C-CD45BA884746}"
EndProject
Expand All @@ -27,7 +27,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LateLoaded", "LateLoaded\La
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "protobuf-net.Extensions", "protobuf-net.Extensions\protobuf-net.Extensions.csproj", "{927AB924-08B5-4629-B505-3BC78A61B0D6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "demo-rpc-client-silverlight", "demo-rpc-client-silverlight\demo-rpc-client-silverlight.csproj", "{7C741476-7F39-4C17-9806-C839A5683463}"
Project("{00000000-0000-0000-0000-000000000000}") = "demo-rpc-client-silverlight", "demo-rpc-client-silverlight\demo-rpc-client-silverlight.csproj", "{7C741476-7F39-4C17-9806-C839A5683463}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "demo-rpc-server-mvc", "demo-rpc-server-mvc\demo-rpc-server-mvc.csproj", "{2F293C90-1DE4-4CE1-AFA7-D0B36E0CA8A9}"
EndProject
Expand Down
4 changes: 2 additions & 2 deletions ProtoGen/Properties/AssemblyInfo.cs
Expand Up @@ -33,5 +33,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.262")]
[assembly: AssemblyFileVersion("1.0.0.262")]
[assembly: AssemblyVersion("1.0.0.264")]
[assembly: AssemblyFileVersion("1.0.0.264")]

0 comments on commit b16ec9b

Please sign in to comment.