diff options
author | Jon Skeet <skeet@pobox.com> | 2008-10-22 13:18:49 +0100 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2008-10-22 13:18:49 +0100 |
commit | f0589506c96600dcd01319b9d1929d87505f3daa (patch) | |
tree | 945bc56e2e2da748271acc8e80deb7ca22aaaf54 /csharp/ProtoGen.Test/DependencyResolutionTest.cs | |
parent | e60ce8bfafca616ed4fd430ae4f82360de165e80 (diff) | |
download | protobuf-f0589506c96600dcd01319b9d1929d87505f3daa.tar.gz protobuf-f0589506c96600dcd01319b9d1929d87505f3daa.tar.bz2 protobuf-f0589506c96600dcd01319b9d1929d87505f3daa.zip |
Wiping slate clean to start again with new layout.
Diffstat (limited to 'csharp/ProtoGen.Test/DependencyResolutionTest.cs')
-rw-r--r-- | csharp/ProtoGen.Test/DependencyResolutionTest.cs | 95 |
1 files changed, 0 insertions, 95 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 |