public void GetValue_ParentClassNotLoaded_ThrowsException() { //Assign SitecoreParentHandlerFixtureNS.ParentClass parent = new Glass.Sitecore.Mapper.Tests.Data.SitecoreParentHandlerFixtureNS.ParentClass(); Item item = _db.GetItem(new ID(_itemId)); SitecoreProperty property = new SitecoreProperty() { Attribute = new SitecoreParentAttribute(), Property = typeof(SitecoreParentHandlerFixtureNS.ParentClass).GetProperty("NotLoaded") }; _handler.ConfigureDataHandler(property); //Act var result = _handler.GetValue( item, _service) as SitecoreParentHandlerFixtureNS.ChildClassNotLoaded; parent.NotLoaded = result; parent.NotLoaded.CallMe = ""; //Assert //expecting an exception }
public void GetValue_NotLazy_ReturnsInstance() { //Assign SitecoreParentHandlerFixtureNS.ParentClass parent = new Glass.Sitecore.Mapper.Tests.Data.SitecoreParentHandlerFixtureNS.ParentClass(); Item item = _db.GetItem(new ID(_itemId)); SitecoreProperty property = new SitecoreProperty() { Attribute = new SitecoreParentAttribute() { IsLazy = false }, Property = typeof(SitecoreParentHandlerFixtureNS.ParentClass).GetProperty("Child") }; _handler.ConfigureDataHandler(property); //Act var result = _handler.GetValue( item, _service) as SitecoreParentHandlerFixtureNS.ChildClass; parent.Child = result; //Assert Assert.AreEqual(typeof(SitecoreParentHandlerFixtureNS.ChildClass), parent.Child.GetType()); }