Permalink
Browse files

Merge pull request #9 from joelowrance/master

"IncludeNamespace" not including without wildcard
  • Loading branch information...
2 parents ff962bf + 61153de commit ac5d9fbb3db51197920eb6775bb57663c3b8b16e @TylerBrinks TylerBrinks committed Aug 15, 2011
Showing with 49 additions and 0 deletions.
  1. +48 −0 Snap.Tests/Bug/IncludeNamespaceBug.cs
  2. +1 −0 Snap.Tests/Snap.Tests.csproj
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using NUnit.Framework;
+
+namespace Snap.Tests.Bug
+{
+ [TestFixture]
+ public class IncludeNamespaceBug
+ {
+ [Test]
+ public void Wildcard_at_root_works_as_expected()
+ {
+ var namespaces = new List<string> {"SnapTests*"};
+ var types = new List<Type> {typeof (SnapTests.Fakes.IBadCode)}.ToArray();
+
+ Assert.AreEqual(typeof(SnapTests.Fakes.IBadCode), types.FirstMatch(namespaces));
+ }
+
+ [Test]
+ public void Wildcard_at_second_level_works_as_expected()
+ {
+ var namespaces = new List<string> { "SnapTests.Fakes*" };
+ var types = new List<Type> { typeof(SnapTests.Fakes.IBadCode) }.ToArray();
+
+ Assert.AreEqual(typeof(SnapTests.Fakes.IBadCode), types.FirstMatch(namespaces));
+ }
+
+ [Test]
+ public void Explicity_naming_a_type_as_an_namespace_to_include_works_but_perhaps_should_not()
+ {
+ var namespaces = new List<string> { "SnapTests.Fakes.IBadCode" };
+ var types = new List<Type> { typeof(SnapTests.Fakes.IBadCode) }.ToArray();
+
+ Assert.AreEqual(typeof(SnapTests.Fakes.IBadCode), types.FirstMatch(namespaces));
+ }
+
+ [Test]
+ public void Explicitly_naming_a_namespace_does_not_work_but_should()
+ {
+ var namespaces = new List<string> { "SnapTests.Fakes" };
+ var types = new List<Type> { typeof(SnapTests.Fakes.IBadCode) }.ToArray();
+
+ Assert.AreEqual(typeof(SnapTests.Fakes.IBadCode), types.FirstMatch(namespaces));
+
+ }
+
+ }
+}
@@ -123,6 +123,7 @@
<ItemGroup>
<Compile Include="AspectTests.cs" />
<Compile Include="AutofacTests.cs" />
+ <Compile Include="Bug\IncludeNamespaceBug.cs" />
<Compile Include="CastleWindsorTests.cs" />
<Compile Include="Fakes\BadCode.cs" />
<Compile Include="Fakes\CustomPrefixScanner.cs" />

0 comments on commit ac5d9fb

Please sign in to comment.