Bug 17262 Theme: Layout.cshtml has to be uppercase.

Fixing the Template Harvester to be case insensitive

--HG--
branch : dev
This commit is contained in:
Suha Can
2011-01-31 17:19:14 -08:00
parent 9adfa13a56
commit fcaaa4e236
3 changed files with 5 additions and 5 deletions

View File

@@ -9,7 +9,7 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
var harvester = new BasicShapeTemplateHarvester();
var harvestShapeHits = harvester.HarvestShape(new HarvestShapeInfo { SubPath = givenSubPath, FileName = givenFileName });
Assert.That(harvestShapeHits.Count(), Is.EqualTo(1));
Assert.That(harvestShapeHits.Single().ShapeType, Is.EqualTo(expectedShapeType));
Assert.That(harvestShapeHits.Single().ShapeType, Is.EqualTo(expectedShapeType).IgnoreCase);
}
[Test]

View File

@@ -140,7 +140,7 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
strategy.Discover(builder);
var alterations = alterationBuilders.Select(alterationBuilder=>alterationBuilder.Build());
Assert.That(alterations.Any(alteration => alteration.ShapeType == "AlphaShape"));
Assert.That(alterations.Any(alteration => alteration.ShapeType.Equals("AlphaShape", StringComparison.OrdinalIgnoreCase)));
}
}

View File

@@ -44,14 +44,14 @@ namespace Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy {
var shapeType = leader + fileName.Replace("--", "__").Replace("-", "__").Replace('.', '_');
if (string.IsNullOrEmpty(displayType)) {
return shapeType;
return shapeType.ToLowerInvariant();
}
var firstBreakingSeparator = shapeType.IndexOf("__");
if (firstBreakingSeparator <= 0) {
return shapeType + "_" + displayType;
return (shapeType + "_" + displayType).ToLowerInvariant();
}
return shapeType.Substring(0, firstBreakingSeparator) + "_" + displayType + shapeType.Substring(firstBreakingSeparator);
return (shapeType.Substring(0, firstBreakingSeparator) + "_" + displayType + shapeType.Substring(firstBreakingSeparator)).ToLowerInvariant();
}
}