Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #9 from joelowrance/master

"IncludeNamespace" not including without wildcard
  • Loading branch information...
commit ac5d9fbb3db51197920eb6775bb57663c3b8b16e 2 parents ff962bf + 61153de
@TylerBrinks TylerBrinks authored
View
48 Snap.Tests/Bug/IncludeNamespaceBug.cs
@@ -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));
+
+ }
+
+ }
+}
View
1  Snap.Tests/Snap.Tests.csproj
@@ -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" />
Please sign in to comment.
Something went wrong with that request. Please try again.