diff options
author | csharptest <roger@csharptest.net> | 2012-10-12 18:22:48 -0500 |
---|---|---|
committer | rogerk <devnull@localhost> | 2012-10-12 18:22:48 -0500 |
commit | ad73b4250d906757b290a8a53d4544a623a7e0d8 (patch) | |
tree | c423bc677dafa155103ea5bcf01a16f8e0ca4de4 /src/ProtocolBuffers.Test | |
parent | 3cf3315370c3aff09353bb0bf3808d67c9e92eda (diff) | |
download | protobuf-ad73b4250d906757b290a8a53d4544a623a7e0d8.tar.gz protobuf-ad73b4250d906757b290a8a53d4544a623a7e0d8.tar.bz2 protobuf-ad73b4250d906757b290a8a53d4544a623a7e0d8.zip |
Fixing build for SILVERLIGHT and COMPACT_FRAMEWORK before adding more build
variations (WP). Changes are primarily superficial since they are to support
the Serialization assembly and unit tests compiling in the CF which has not
been done before.
Diffstat (limited to 'src/ProtocolBuffers.Test')
-rw-r--r-- | src/ProtocolBuffers.Test/CodedOutputStreamTest.cs | 2 | ||||
-rw-r--r-- | src/ProtocolBuffers.Test/Compatibility/TextCompatibilityTests.cs | 7 | ||||
-rw-r--r-- | src/ProtocolBuffers.Test/IssuesTest.cs | 14 | ||||
-rw-r--r-- | src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs | 4 | ||||
-rw-r--r-- | src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj | 21 | ||||
-rw-r--r-- | src/ProtocolBuffers.Test/ReusableBuilderTest.cs | 3 | ||||
-rw-r--r-- | src/ProtocolBuffers.Test/SerializableTest.cs | 4 | ||||
-rw-r--r-- | src/ProtocolBuffers.Test/TestUtil.cs | 7 | ||||
-rw-r--r-- | src/ProtocolBuffers.Test/TextFormatTest.cs | 9 |
9 files changed, 53 insertions, 18 deletions
diff --git a/src/ProtocolBuffers.Test/CodedOutputStreamTest.cs b/src/ProtocolBuffers.Test/CodedOutputStreamTest.cs index ce0c57c4..f6e7537c 100644 --- a/src/ProtocolBuffers.Test/CodedOutputStreamTest.cs +++ b/src/ProtocolBuffers.Test/CodedOutputStreamTest.cs @@ -196,7 +196,7 @@ namespace Google.ProtocolBuffers 0x9abcdef012345678UL);
}
-#if !SILVERLIGHT
+#if !SILVERLIGHT && !COMPACT_FRAMEWORK
[TestMethod]
public void WriteWholeMessage()
{
diff --git a/src/ProtocolBuffers.Test/Compatibility/TextCompatibilityTests.cs b/src/ProtocolBuffers.Test/Compatibility/TextCompatibilityTests.cs index 9c0afe46..c2eaadf6 100644 --- a/src/ProtocolBuffers.Test/Compatibility/TextCompatibilityTests.cs +++ b/src/ProtocolBuffers.Test/Compatibility/TextCompatibilityTests.cs @@ -19,14 +19,15 @@ namespace Google.ProtocolBuffers.Compatibility TextFormat.Merge(new StringReader((string)message), registry, (IBuilder)builder);
return builder;
}
-
- [TestMethod, System.ComponentModel.Description("This test can take a very long time to run.")]
+ //This test can take a very long time to run.
+ [TestMethod]
public override void RoundTripMessage2OptimizeSize()
{
//base.RoundTripMessage2OptimizeSize();
}
- [TestMethod, System.ComponentModel.Description("This test can take a very long time to run.")]
+ //This test can take a very long time to run.
+ [TestMethod]
public override void RoundTripMessage2OptimizeSpeed()
{
//base.RoundTripMessage2OptimizeSpeed();
diff --git a/src/ProtocolBuffers.Test/IssuesTest.cs b/src/ProtocolBuffers.Test/IssuesTest.cs index 7096a52d..a80021c5 100644 --- a/src/ProtocolBuffers.Test/IssuesTest.cs +++ b/src/ProtocolBuffers.Test/IssuesTest.cs @@ -34,26 +34,32 @@ #endregion
+
+using System;
+using System.Collections.Generic;
+using Google.ProtocolBuffers.Collections;
using Google.ProtocolBuffers.Descriptors;
-using NUnit.Framework;
+using Google.ProtocolBuffers.TestProtos;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
using UnitTest.Issues.TestProtos;
+
namespace Google.ProtocolBuffers
{
/// <summary>
/// Tests for issues which aren't easily compartmentalized into other unit tests.
/// </summary>
- [TestFixture]
+ [TestClass]
public class IssuesTest
{
// Issue 45
- [Test]
+ [TestMethod]
public void FieldCalledItem()
{
ItemField message = new ItemField.Builder { Item = 3 }.Build();
FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item");
Assert.IsNotNull(field);
- Assert.AreEqual(3, message[field]);
+ Assert.AreEqual(3, (int)message[field]);
}
}
}
diff --git a/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs b/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs index 7b9c24d1..676b565f 100644 --- a/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs +++ b/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs @@ -38,7 +38,11 @@ using System.Runtime.InteropServices; // [assembly: AssemblyVersion("2.4.1.473")]
[assembly: AssemblyVersion("2.4.1.473")]
+#if !COMPACT_FRAMEWORK
[assembly: AssemblyFileVersion("2.4.1.473")]
+
+#endif
+
// We don't really need CLSCompliance, but if the assembly builds with no warnings,
// that means the generator is okay.
diff --git a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj index 07ccf81e..3ef8a946 100644 --- a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj +++ b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
+ <TargetFrameworkClass>CLIENTPROFILE</TargetFrameworkClass>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
@@ -58,14 +59,25 @@ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="mscorlib" />
+ <Reference Include="System" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup Condition=" '$(TargetFrameworkClass)' == 'CLIENTPROFILE' ">
<Reference Include="nunit.framework">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\NUnit\lib\nunit.framework.dll</HintPath>
</Reference>
- <Reference Include="mscorlib" />
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup Condition=" '$(TargetFrameworkClass)' != 'CLIENTPROFILE' ">
+ <Reference Include="Microsoft.Silverlight.Testing, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll</HintPath>
+ </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\lib\NUnit-config\Microsoft.VisualStudio.TestTools.cs">
@@ -83,6 +95,7 @@ <Compile Include="Compatibility\TestResources.cs" />
<Compile Include="Compatibility\TextCompatibilityTests.cs" />
<Compile Include="Compatibility\XmlCompatibilityTests.cs" />
+ <Compile Include="SerializableAttribute.cs" />
<Compile Include="TestProtos\UnitTestExtrasProtoFile.cs" />
<Compile Include="TestRpcForMimeTypes.cs" />
<Compile Include="TestReaderForUrlEncoded.cs" />
diff --git a/src/ProtocolBuffers.Test/ReusableBuilderTest.cs b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs index 93129b2f..a63f6575 100644 --- a/src/ProtocolBuffers.Test/ReusableBuilderTest.cs +++ b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs @@ -13,7 +13,8 @@ namespace Google.ProtocolBuffers [TestClass]
public class ReusableBuilderTest
{
- [TestMethod, System.ComponentModel.Description("Issue 28: Circular message dependencies result in null defaults for DefaultInstance")]
+ //Issue 28: Circular message dependencies result in null defaults for DefaultInstance
+ [TestMethod]
public void EnsureStaticCicularReference()
{
MyMessageAReferenceB ab = MyMessageAReferenceB.DefaultInstance;
diff --git a/src/ProtocolBuffers.Test/SerializableTest.cs b/src/ProtocolBuffers.Test/SerializableTest.cs index edf6ce49..b55358ef 100644 --- a/src/ProtocolBuffers.Test/SerializableTest.cs +++ b/src/ProtocolBuffers.Test/SerializableTest.cs @@ -1,4 +1,5 @@ -using System;
+#if !SILVERLIGHT && !COMPACT_FRAMEWORK
+using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
@@ -175,3 +176,4 @@ namespace Google.ProtocolBuffers }
}
}
+#endif
\ No newline at end of file diff --git a/src/ProtocolBuffers.Test/TestUtil.cs b/src/ProtocolBuffers.Test/TestUtil.cs index dd1c981d..12d73d16 100644 --- a/src/ProtocolBuffers.Test/TestUtil.cs +++ b/src/ProtocolBuffers.Test/TestUtil.cs @@ -49,12 +49,11 @@ using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert; using Microsoft.VisualStudio.TestTools.UnitTesting;
#endif
-
namespace Google.ProtocolBuffers
{
internal static class TestUtil
{
-#if !SILVERLIGHT
+#if !SILVERLIGHT && !COMPACT_FRAMEWORK
private static string testDataDirectory;
internal static string TestDataDirectory
@@ -1769,6 +1768,9 @@ namespace Google.ProtocolBuffers public static void TestInMultipleCultures(CultureAction test)
{
+#if COMPACT_FRAMEWORK
+ test();
+#else
CultureInfo originalCulture = Thread.CurrentThread.CurrentCulture;
foreach (string culture in TestCultures)
{
@@ -1782,6 +1784,7 @@ namespace Google.ProtocolBuffers Thread.CurrentThread.CurrentCulture = originalCulture;
}
}
+#endif
}
/// <summary>
diff --git a/src/ProtocolBuffers.Test/TextFormatTest.cs b/src/ProtocolBuffers.Test/TextFormatTest.cs index 299b2650..10ab4e15 100644 --- a/src/ProtocolBuffers.Test/TextFormatTest.cs +++ b/src/ProtocolBuffers.Test/TextFormatTest.cs @@ -41,6 +41,7 @@ using Google.ProtocolBuffers.TestProtos; using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Globalization;
using System.Threading;
+#if !SILVERLIGHT && !COMPACT_FRAMEWORK
namespace Google.ProtocolBuffers
{
@@ -175,7 +176,10 @@ namespace Google.ProtocolBuffers /// </summary>
private static ByteString Bytes(string str)
{
- return ByteString.CopyFrom(Encoding.GetEncoding(28591).GetBytes(str));
+ byte[] bytes = new byte[str.Length];
+ for (int i = 0; i < bytes.Length; i++)
+ bytes[i] = (byte)str[i];
+ return ByteString.CopyFrom(bytes);
}
[TestMethod]
@@ -568,4 +572,5 @@ namespace Google.ProtocolBuffers Assert.AreEqual(longText, builder.OptionalString);
}
}
-}
\ No newline at end of file +}
+#endif
\ No newline at end of file |