Permalink
Browse files

Added DefaultTextResouceFixture

  • Loading branch information...
1 parent afec084 commit e4e54a5eef15b43bc609b4f536ff910cedc3a589 @jchannon jchannon committed Dec 22, 2012
@@ -61,7 +61,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Modules\HomeModule.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\Text.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -102,6 +101,9 @@
<Name>Nancy</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <Folder Include="Properties\" />
+ </ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
@@ -231,6 +231,7 @@
<Compile Include="Unit\Validation\ValidationResultFixture.cs" />
<Compile Include="Unit\Validation\DefaultValidatorLocatorFixture.cs" />
<Compile Include="Unit\ViewEngines\DefaultRenderContextFixture.cs" />
+ <Compile Include="Unit\ViewEngines\DefaultTextResourceFixture.cs" />
<Compile Include="Unit\ViewEngines\DefaultViewLocationCacheFixture.cs" />
<Compile Include="Fakes\FakeViewLocationCache.cs" />
<Compile Include="Fakes\FakeViewEngine.cs" />
@@ -0,0 +1,22 @@
+namespace Nancy.Tests.Unit.ViewEngines
+{
+ using Nancy.ViewEngines;
+ using Xunit;
+
+ public class DefaultTextResourceFixture
+ {
+ [Fact]
+ public void Should_Return_Null_If_No_Assembly_Found()
+ {
+ //Given
+ var defaultTextResource = new DefaultTextResource();
+ var context = new NancyContext();
+
+ //When
+ var result = defaultTextResource["Greeting", context];
+
+ //Then
+ result.ShouldBeNull();
+ }
+ }
+}
@@ -14,7 +14,7 @@ public DefaultTextResource()
{
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
- culturedAssembly = assemblies.FirstOrDefault(x => x.GetManifestResourceNames().Any(y => y.Contains("Text.")));
+ culturedAssembly = assemblies.FirstOrDefault(x => x.GetManifestResourceNames().Any(y => y.Contains(".Resources.Text")));
if (culturedAssembly != null)
{
resourceManager = new ResourceManager(culturedAssembly.GetName().Name + ".Resources.Text",

0 comments on commit e4e54a5

Please sign in to comment.