Skip to content

Commit

Permalink
Restored Pluralization test to BehaviourTests
Browse files Browse the repository at this point in the history
  • Loading branch information
markrendle committed Nov 27, 2011
1 parent 60a5dd6 commit 9efbefe
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
38 changes: 38 additions & 0 deletions Simple.Data.BehaviourTest/NameResolutionTests.cs
@@ -1,4 +1,5 @@
using System;
using System.Data.Entity.Design.PluralizationServices;
using NUnit.Framework;
using Simple.Data.Ado;
using Simple.Data.Mocking.Ado;
Expand Down Expand Up @@ -65,6 +66,43 @@ public void IndexerMethodWorksWithSchemaAndPluralFromSingular()
GeneratedSqlIs("select [dbo].[Customers].[CustomerId] from [dbo].[Customers]");
}

#if(!MONO)
[Test]
public void CompaniesPluralizationIsResolved()
{
Database.SetPluralizer(new EntityPluralizer());
_db.Companies.All().ToList();
GeneratedSqlIs("select [dbo].[Company].[Id] from [dbo].[Company]");
}

class EntityPluralizer : IPluralizer
{
private readonly PluralizationService _pluralizationService =
PluralizationService.CreateService(CultureInfo.CurrentCulture);

public bool IsPlural(string word)
{
return _pluralizationService.IsPlural(word);
}

public bool IsSingular(string word)
{
return _pluralizationService.IsSingular(word);
}

public string Pluralize(string word)
{
bool upper = (word.IsAllUpperCase());
word = _pluralizationService.Pluralize(word);
return upper ? word.ToUpper(_pluralizationService.Culture) : word;
}

public string Singularize(string word)
{
return _pluralizationService.Singularize(word);
}
}
#endif
}

[TestFixture]
Expand Down
1 change: 0 additions & 1 deletion Simple.Data/MefHelper.cs
Expand Up @@ -76,7 +76,6 @@ private static CompositionContainer CreateContainer()
var catalog = new AssemblyCatalog(file);
aggregateCatalog.Catalogs.Add(catalog);
}
// var folderCatalog = new DirectoryCatalog(path, "Simple.Data.*.dll");
return new CompositionContainer(aggregateCatalog);
}
}
Expand Down

0 comments on commit 9efbefe

Please sign in to comment.