Permalink
Browse files

additional sc query mapper test

  • Loading branch information...
mikeedwards83 committed Apr 1, 2013
1 parent dcd3028 commit 0dde1f2b981a0258d6048f4a1e94132065bd553c
@@ -146,6 +146,36 @@ public void CanHandle_IncorrectConfigMappedClass_ReturnsFalse()
#region Method - MapToProperty
+ [Test]
+ public void MapToProperty_RelativeQuery_ReturnsNoResults()
+ {
+ //Assign
+ //Assign
+ var config = new SitecoreQueryConfiguration();
+ config.PropertyInfo = new FakePropertyInfo(typeof(IEnumerable<StubMapped>));
+ config.Query = "../Results/DoesNotExist/*";
+ config.IsRelative = true;
+
+ var context = Context.Create(DependencyResolver.CreateStandardResolver());
+ context.Load(new SitecoreAttributeConfigurationLoader("Glass.Mapper.Sc.Integration"));
+
+ var mapper = new SitecoreQueryMapper(null);
+ mapper.Setup(new DataMapperResolverArgs(context, config));
+
+ var source = Database.GetItem("/sitecore/content/Tests/DataMappers/SitecoreQueryMapper/Source");
+ var service = new SitecoreService(Database, context);
+
+ var result1 = Database.GetItem("/sitecore/content/Tests/DataMappers/SitecoreQueryMapper/Results/Result1");
+ var result2 = Database.GetItem("/sitecore/content/Tests/DataMappers/SitecoreQueryMapper/Results/Result2");
+
+ //Act
+ var results =
+ mapper.MapToProperty(new SitecoreDataMappingContext(null, source, service)) as IEnumerable<StubMapped>;
+
+ //Assert
+ Assert.AreEqual(0, results.Count());
+ }
+
[Test]
public void MapToProperty_RelativeQuery_ReturnsResults()
{

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 0dde1f2

Please sign in to comment.