aboutsummaryrefslogtreecommitdiff
path: root/csharp/ProtoGen.Test
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/ProtoGen.Test')
-rw-r--r--csharp/ProtoGen.Test/DependencyResolutionTest.cs95
-rw-r--r--csharp/ProtoGen.Test/DescriptorUtilTest.cs69
-rw-r--r--csharp/ProtoGen.Test/GeneratorTest.cs10
-rw-r--r--csharp/ProtoGen.Test/HelpersTest.cs33
-rw-r--r--csharp/ProtoGen.Test/Properties/AssemblyInfo.cs36
-rw-r--r--csharp/ProtoGen.Test/Properties/Google.ProtocolBuffers.ProtoGen.Test.snkbin596 -> 0 bytes
-rw-r--r--csharp/ProtoGen.Test/ProtoGen.Test.csproj76
7 files changed, 0 insertions, 319 deletions
diff --git a/csharp/ProtoGen.Test/DependencyResolutionTest.cs b/csharp/ProtoGen.Test/DependencyResolutionTest.cs
deleted file mode 100644
index ef911263..00000000
--- a/csharp/ProtoGen.Test/DependencyResolutionTest.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Google.ProtocolBuffers.Descriptors;
-using NUnit.Framework;
-using Google.ProtocolBuffers.DescriptorProtos;
-using Google.ProtocolBuffers.ProtoGen;
-
-namespace Google.ProtocolBuffers.ProtoGen {
- /// <summary>
- /// Tests for the dependency resolution in Generator.
- /// </summary>
- [TestFixture]
- public class DependencyResolutionTest {
-
- [Test]
- public void TwoDistinctFiles() {
- FileDescriptorProto first = new FileDescriptorProto.Builder { Name="First" }.Build();
- FileDescriptorProto second = new FileDescriptorProto.Builder { Name="Second" }.Build();
- FileDescriptorSet set = new FileDescriptorSet { FileList = { first, second } };
-
- IList<FileDescriptor> converted = Generator.ConvertDescriptors(set);
- Assert.AreEqual(2, converted.Count);
- Assert.AreEqual("First", converted[0].Name);
- Assert.AreEqual(0, converted[0].Dependencies.Count);
- Assert.AreEqual("Second", converted[1].Name);
- Assert.AreEqual(0, converted[1].Dependencies.Count);
- }
-
- [Test]
- public void FirstDependsOnSecond() {
- FileDescriptorProto first = new FileDescriptorProto.Builder { Name = "First", DependencyList = {"Second"} }.Build();
- FileDescriptorProto second = new FileDescriptorProto.Builder { Name = "Second" }.Build();
- FileDescriptorSet set = new FileDescriptorSet { FileList = { first, second } };
- IList<FileDescriptor> converted = Generator.ConvertDescriptors(set);
- Assert.AreEqual(2, converted.Count);
- Assert.AreEqual("First", converted[0].Name);
- Assert.AreEqual(1, converted[0].Dependencies.Count);
- Assert.AreEqual(converted[1], converted[0].Dependencies[0]);
- Assert.AreEqual("Second", converted[1].Name);
- Assert.AreEqual(0, converted[1].Dependencies.Count);
- }
-
- [Test]
- public void SecondDependsOnFirst() {
- FileDescriptorProto first = new FileDescriptorProto.Builder { Name = "First" }.Build();
- FileDescriptorProto second = new FileDescriptorProto.Builder { Name = "Second", DependencyList = {"First"} }.Build();
- FileDescriptorSet set = new FileDescriptorSet { FileList = { first, second } };
- IList<FileDescriptor> converted = Generator.ConvertDescriptors(set);
- Assert.AreEqual(2, converted.Count);
- Assert.AreEqual("First", converted[0].Name);
- Assert.AreEqual(0, converted[0].Dependencies.Count);
- Assert.AreEqual("Second", converted[1].Name);
- Assert.AreEqual(1, converted[1].Dependencies.Count);
- Assert.AreEqual(converted[0], converted[1].Dependencies[0]);
- }
-
- [Test]
- public void CircularDependency() {
- FileDescriptorProto first = new FileDescriptorProto.Builder { Name = "First", DependencyList = { "Second" } }.Build();
- FileDescriptorProto second = new FileDescriptorProto.Builder { Name = "Second", DependencyList = { "First" } }.Build();
- FileDescriptorSet set = new FileDescriptorSet { FileList = { first, second } };
- try {
- Generator.ConvertDescriptors(set);
- Assert.Fail("Expected exception");
- } catch (DependencyResolutionException) {
- // Expected
- }
- }
-
- [Test]
- public void MissingDependency() {
- FileDescriptorProto first = new FileDescriptorProto.Builder { Name = "First", DependencyList = { "Second" } }.Build();
- FileDescriptorSet set = new FileDescriptorSet { FileList = { first } };
- try {
- Generator.ConvertDescriptors(set);
- Assert.Fail("Expected exception");
- } catch (DependencyResolutionException) {
- // Expected
- }
- }
-
- [Test]
- public void SelfDependency() {
- FileDescriptorProto first = new FileDescriptorProto.Builder { Name = "First", DependencyList = { "First" } }.Build();
- FileDescriptorSet set = new FileDescriptorSet { FileList = { first } };
- try {
- Generator.ConvertDescriptors(set);
- Assert.Fail("Expected exception");
- } catch (DependencyResolutionException) {
- // Expected
- }
- }
- }
-} \ No newline at end of file
diff --git a/csharp/ProtoGen.Test/DescriptorUtilTest.cs b/csharp/ProtoGen.Test/DescriptorUtilTest.cs
deleted file mode 100644
index 5674892e..00000000
--- a/csharp/ProtoGen.Test/DescriptorUtilTest.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-using Google.ProtocolBuffers.DescriptorProtos;
-using Google.ProtocolBuffers.Descriptors;
-using NUnit.Framework;
-
-namespace Google.ProtocolBuffers.ProtoGen {
- [TestFixture]
- public class DescriptorUtilTest {
-
- [Test]
- public void ExplicitNamespace() {
- FileDescriptorProto proto = new FileDescriptorProto.Builder {
- Name = "x", Package = "pack", Options = new FileOptions.Builder().SetExtension(CSharpOptions.CSharpNamespace, "Foo.Bar").Build()
- }.Build();
- FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null);
- Assert.AreEqual("Foo.Bar", DescriptorUtil.GetNamespace(descriptor));
- }
-
- [Test]
- public void NoNamespaceFallsBackToPackage() {
- FileDescriptorProto proto = new FileDescriptorProto.Builder { Name = "x", Package = "pack" }.Build();
- FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null);
- Assert.AreEqual("pack", DescriptorUtil.GetNamespace(descriptor));
- }
-
- [Test]
- public void NoNamespaceOrPackageFallsBackToEmptyString() {
- FileDescriptorProto proto = new FileDescriptorProto.Builder { Name = "x" }.Build();
- FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null);
- Assert.AreEqual("", DescriptorUtil.GetNamespace(descriptor));
- }
-
- [Test]
- public void ExplicitlyNamedFileClass() {
- FileDescriptorProto proto = new FileDescriptorProto.Builder {
- Name = "x", Options = new FileOptions.Builder().SetExtension(CSharpOptions.CSharpUmbrellaClassname, "Foo").Build()
- }.Build();
- FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null);
- Assert.AreEqual("Foo", DescriptorUtil.GetUmbrellaClassName(descriptor));
- }
-
- [Test]
- public void ImplicitFileClassWithProtoSuffix() {
- FileDescriptorProto proto = new FileDescriptorProto.Builder { Name = "foo_bar.proto" }.Build();
- FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null);
- Assert.AreEqual("FooBar", DescriptorUtil.GetUmbrellaClassName(descriptor));
- }
-
- [Test]
- public void ImplicitFileClassWithProtoDevelSuffix() {
- FileDescriptorProto proto = new FileDescriptorProto.Builder { Name = "foo_bar.protodevel" }.Build();
- FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null);
- Assert.AreEqual("FooBar", DescriptorUtil.GetUmbrellaClassName(descriptor));
- }
-
- [Test]
- public void ImplicitFileClassWithNoSuffix() {
- FileDescriptorProto proto = new FileDescriptorProto.Builder { Name = "foo_bar" }.Build();
- FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null);
- Assert.AreEqual("FooBar", DescriptorUtil.GetUmbrellaClassName(descriptor));
- }
-
- [Test]
- public void ImplicitFileClassWithDirectoryStructure() {
- FileDescriptorProto proto = new FileDescriptorProto.Builder { Name = "x/y/foo_bar" }.Build();
- FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null);
- Assert.AreEqual("FooBar", DescriptorUtil.GetUmbrellaClassName(descriptor));
- }
- }
-}
diff --git a/csharp/ProtoGen.Test/GeneratorTest.cs b/csharp/ProtoGen.Test/GeneratorTest.cs
deleted file mode 100644
index dbd18787..00000000
--- a/csharp/ProtoGen.Test/GeneratorTest.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using Google.ProtocolBuffers.DescriptorProtos;
-using NUnit.Framework;
-using Google.ProtocolBuffers.Descriptors;
-
-namespace Google.ProtocolBuffers.ProtoGen {
- [TestFixture]
- public class GeneratorTest {
-
- }
-} \ No newline at end of file
diff --git a/csharp/ProtoGen.Test/HelpersTest.cs b/csharp/ProtoGen.Test/HelpersTest.cs
deleted file mode 100644
index af084973..00000000
--- a/csharp/ProtoGen.Test/HelpersTest.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using Google.ProtocolBuffers.ProtoGen;
-using NUnit.Framework;
-
-namespace Google.ProtocolBuffers.ProtoGen {
- [TestFixture]
- public class HelpersTest {
-
- [Test]
- public void UnderscoresToPascalCase() {
- Assert.AreEqual("FooBar", Helpers.UnderscoresToPascalCase("Foo_bar"));
- Assert.AreEqual("FooBar", Helpers.UnderscoresToPascalCase("foo_bar"));
- Assert.AreEqual("Foo0Bar", Helpers.UnderscoresToPascalCase("Foo0bar"));
- Assert.AreEqual("FooBar", Helpers.UnderscoresToPascalCase("Foo_+_Bar"));
- }
-
- [Test]
- public void UnderscoresToCamelCase() {
- Assert.AreEqual("fooBar", Helpers.UnderscoresToCamelCase("Foo_bar"));
- Assert.AreEqual("fooBar", Helpers.UnderscoresToCamelCase("foo_bar"));
- Assert.AreEqual("foo0Bar", Helpers.UnderscoresToCamelCase("Foo0bar"));
- Assert.AreEqual("fooBar", Helpers.UnderscoresToCamelCase("Foo_+_Bar"));
- }
-
- [Test]
- public void StripSuffix() {
- string text = "FooBar";
- Assert.IsFalse(Helpers.StripSuffix(ref text, "Foo"));
- Assert.AreEqual("FooBar", text);
- Assert.IsTrue(Helpers.StripSuffix(ref text, "Bar"));
- Assert.AreEqual("Foo", text);
- }
- }
-} \ No newline at end of file
diff --git a/csharp/ProtoGen.Test/Properties/AssemblyInfo.cs b/csharp/ProtoGen.Test/Properties/AssemblyInfo.cs
deleted file mode 100644
index 98a0a384..00000000
--- a/csharp/ProtoGen.Test/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("ProtoGen.Test")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("ProtoGen.Test")]
-[assembly: AssemblyCopyright("Copyright © 2008")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("40720ee3-2d15-4271-8c42-8f9cfd01b52f")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// 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.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/csharp/ProtoGen.Test/Properties/Google.ProtocolBuffers.ProtoGen.Test.snk b/csharp/ProtoGen.Test/Properties/Google.ProtocolBuffers.ProtoGen.Test.snk
deleted file mode 100644
index 3f53cbd4..00000000
--- a/csharp/ProtoGen.Test/Properties/Google.ProtocolBuffers.ProtoGen.Test.snk
+++ /dev/null
Binary files differ
diff --git a/csharp/ProtoGen.Test/ProtoGen.Test.csproj b/csharp/ProtoGen.Test/ProtoGen.Test.csproj
deleted file mode 100644
index 83e6f961..00000000
--- a/csharp/ProtoGen.Test/ProtoGen.Test.csproj
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{C268DA4C-4004-47DA-AF23-44C983281A68}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Google.ProtocolBuffers.ProtoGen</RootNamespace>
- <AssemblyName>Google.ProtocolBuffers.ProtoGen.Test</AssemblyName>
- <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <SignAssembly>true</SignAssembly>
- <AssemblyOriginatorKeyFile>Properties\Google.ProtocolBuffers.ProtoGen.Test.snk</AssemblyOriginatorKeyFile>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\lib\nunit.framework.dll</HintPath>
- </Reference>
- <Reference Include="Rhino.Mocks, Version=3.5.0.2, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\lib\Rhino.Mocks.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="DependencyResolutionTest.cs" />
- <Compile Include="DescriptorUtilTest.cs" />
- <Compile Include="GeneratorTest.cs" />
- <Compile Include="HelpersTest.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\ProtocolBuffers\ProtocolBuffers.csproj">
- <Project>{6908BDCE-D925-43F3-94AC-A531E6DF2591}</Project>
- <Name>ProtocolBuffers</Name>
- </ProjectReference>
- <ProjectReference Include="..\ProtoGen\ProtoGen.csproj">
- <Project>{250ADE34-82FD-4BAE-86D5-985FBE589C4A}</Project>
- <Name>ProtoGen</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="Properties\Google.ProtocolBuffers.ProtoGen.Test.snk" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project> \ No newline at end of file