public Execute ( Glass.Mapper.Pipelines.ConfigurationResolver.ConfigurationResolverArgs args ) : void | ||
args | Glass.Mapper.Pipelines.ConfigurationResolver.ConfigurationResolverArgs | The args. |
Результат | void |
public void Execute_CreatesInferredType() { //Arrange using (Db database = new Db { new DbTemplate(new ID(StubInferred.TemplateId)), new Sitecore.FakeDb.DbItem("Target", ID.NewID, new ID(StubInferred.TemplateId)) }) { var context = Context.Create(FakeDb.Utilities.CreateStandardResolver()); var path = "/sitecore/content/Target"; context.Load(new AttributeTypeLoader(typeof(StubInferred))); var typeContext = new SitecoreTypeCreationContext(); var args = new ConfigurationResolverArgs(context, typeContext, null, null); var task = new TemplateInferredTypeTask(); typeContext.InferType = true; typeContext.Item = database.GetItem(path); typeContext.RequestedType = typeof(IBase); args.RequestedType = typeof(IBase); //Act task.Execute(args); //Assert Assert.IsNotNull(args.Result); Assert.AreEqual(typeof(StubInferred), args.Result.Type); } }
public void Execute_CreatesInferredType() { //Arrange var db = Sitecore.Configuration.Factory.GetDatabase("master"); var context = Context.Create(Utilities.CreateStandardResolver()); var path = "/sitecore/content/Tests/Pipelines/ConfigurationResolver/TemplateInferredTypeTask/Target"; context.Load(new AttributeTypeLoader(typeof(StubInferred))); var typeContext = new SitecoreTypeCreationContext(); var args = new ConfigurationResolverArgs(context, typeContext, null, null); var task = new TemplateInferredTypeTask(); typeContext.InferType = true; typeContext.Item = db.GetItem(path); typeContext.RequestedType = typeof (IBase); args.RequestedType = typeof (IBase); //Act task.Execute(args); //Assert Assert.IsNotNull(args.Result); Assert.AreEqual(typeof(StubInferred), args.Result.Type); }
public void Execute_NotInferred_ResultNull() { //Arrange var args = new ConfigurationResolverArgs(null, new SitecoreTypeCreationContext(), null, null); var task = new TemplateInferredTypeTask(); args.AbstractTypeCreationContext.InferType = false; //Act task.Execute(args); //Assert Assert.IsNull(args.Result); }
public void Execute_ResultNotNull_Returns() { //Arrange var args = new ConfigurationResolverArgs(null, null, null, null); var task = new TemplateInferredTypeTask(); var expected = new SitecoreTypeConfiguration(); args.Result = expected; //Act task.Execute(args); //Assert Assert.AreEqual(expected, args.Result); }