From 5238848c618e4eaabe0828ab5c5cb34bccd44a58 Mon Sep 17 00:00:00 2001 From: jonfuller Date: Tue, 31 Mar 2009 22:55:45 -0400 Subject: [PATCH 1/2] Fix duplicate type names in different namespaces issue. --- src/Docu.Console/Parsing/Model/TypeIdentifier.cs | 2 +- .../DocumentModelGeneratorTests/General.cs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletions(-) diff --git a/src/Docu.Console/Parsing/Model/TypeIdentifier.cs b/src/Docu.Console/Parsing/Model/TypeIdentifier.cs index fec2525..41f3735 100644 --- a/src/Docu.Console/Parsing/Model/TypeIdentifier.cs +++ b/src/Docu.Console/Parsing/Model/TypeIdentifier.cs @@ -5,7 +5,7 @@ namespace Docu.Parsing.Model private readonly string _namespace; public TypeIdentifier(string name, string ns) - : base(name) + : base(string.Format("{0}.{1}", ns, name)) { _namespace = ns; } diff --git a/src/Docu.Tests/Documentation/DocumentModelGeneratorTests/General.cs b/src/Docu.Tests/Documentation/DocumentModelGeneratorTests/General.cs index 64932b5..7a8c4bc 100644 --- a/src/Docu.Tests/Documentation/DocumentModelGeneratorTests/General.cs +++ b/src/Docu.Tests/Documentation/DocumentModelGeneratorTests/General.cs @@ -31,6 +31,23 @@ namespace Docu.Tests.Documentation.DocumentModelGeneratorTests } [Test] + public void ShouldHaveTypesWithSameNamesInDifferentNamespaces() + { + var model = new DocumentModel(StubParser, StubEventAggregator); + var members = new[] + { + Type(@""), + Type(@""), + }; + var namespaces = model.Create(members); + + namespaces[0].Types + .ShouldContain(x => x.IsIdentifiedBy(Identifier.FromType(typeof(Example.Duplicate)))); + namespaces[1].Types + .ShouldContain(x => x.IsIdentifiedBy(Identifier.FromType(typeof(Example2.Duplicate)))); + } + + [Test] public void ShouldHaveParentForTypes() { var model = new DocumentModel(StubParser, StubEventAggregator); -- 1.6.2.msysgit.0.186.gf7512