public void Compile_EmptyCompilers()
        {
            var context = CreateContext(new IFieldCompiler[0]);
            var field = new Field(Item.Empty, null) {Value = "Lorem Ipsum"};

            field.Compile(context);

            Assert.That(field.IsCompiled, Is.False);
        }
        public void Compile_NoMatchingCompiler()
        {
            var compilers = new IFieldCompiler[] { new CheckboxFieldCompiler() };
            var project = new Project(null, null, null, null, null, null);
            var template = CreateTemplate(project);
            var context = CreateContext(compilers);

            var item = new Item(project, TextNode.Empty, Guid.NewGuid(), "master", "item", "/sitecore/item", template.ItemIdOrPath);
            project.AddOrMerge(item);

            var field = new Field(item, null)
            {
                FieldName = "Text",
                Value = "Lorem Ipsum"
            };

            field.Compile(context);

            Assert.That(field.IsCompiled, Is.False);
        }
        public void Compile_ExclusiveCompiler()
        {
            var compilers = new IFieldCompiler[] { new CheckboxFieldCompiler(), new ReplaceCompiler("alpha")  };
            var project = new Project(null, null, null, null, null, null);
            var template = CreateTemplate(project);
            var context = CreateContext(compilers);

            var item = new Item(project, TextNode.Empty, Guid.NewGuid(), "master", "item", "/sitecore/item", template.ItemName);
            project.AddOrMerge(item);

            var field = new Field(item, null)
            {
                FieldName = "Checkbox",
                Value = "True"
            };

            field.Compile(context);

            Assert.That(field.IsCompiled, Is.True);
            Assert.That(field.CompiledValue, Is.EqualTo("1"));
        }