public override void Emit(IEmitContext context, IProjectItem projectItem)
        {
            var unicornFile = projectItem as UnicornFile;
            Assert.Cast(unicornFile, nameof(unicornFile));

            var snapshot = unicornFile.Snapshots.First();

            // todo: use real Unicorn configuration instead of hacking it
            var log = new TraceLogger(context.Trace);
            var logger = new DefaultDeserializerLogger(log);
            var fieldFilter = new AllFieldFilter();
            var defaultDeserializer = new DefaultDeserializer(logger, fieldFilter);

            // todo: file has already been read and parsed - do not read it again
            var formatter = new YamlSerializationFormatter(null, null);
            using (var stream = new FileStream(snapshot.SourceFile.AbsoluteFileName, FileMode.Open))
            {
                var serializedItem = formatter.ReadSerializedItem(stream, unicornFile.ShortName);

                if (string.IsNullOrEmpty(serializedItem.DatabaseName))
                {
                    serializedItem.DatabaseName = unicornFile.DatabaseName;
                }

                try
                {
                    defaultDeserializer.Deserialize(serializedItem);
                }
                catch (Exception ex)
                {
                    throw new RetryableEmitException(Texts.Failed_to_deserialize_item, unicornFile.Snapshots.First(), ex.Message);
                }
            }
        }
		protected IDeserializer CreateTestDeserializer(Db db)
		{
			var fieldFilter = Substitute.For<IFieldFilter>();
			fieldFilter.Includes(Arg.Any<Guid>()).Returns(true);

			var deserializer = new DefaultDeserializer(Substitute.For<IDefaultDeserializerLogger>(), fieldFilter);
			deserializer.ParentDataStore = new SitecoreDataStore(deserializer);

			db.Add(new DbTemplate("Test Template", _testTemplateId)
			{
				new DbField("Test Field", _testVersionedFieldId),
				new DbField("Test Shared", _testSharedFieldId) { Shared = true }
			});

			db.Add(new DbTemplate("Test Template2", _testTemplate2Id)
			{
				new DbField("Test Field"),
				new DbField("Test Shared") { Shared = true }
			});

			return deserializer;
		}
		public void Deserialize_IgnoresField_ExcludedWithFieldFilter()
		{
			var ignoredFieldId = ID.NewID;

			var fieldFilter = Substitute.For<IFieldFilter>();
			fieldFilter.Includes(Arg.Any<Guid>()).Returns(true);
			fieldFilter.Includes(ignoredFieldId.Guid).Returns(false);

			var deserializer = new DefaultDeserializer(Substitute.For<IDefaultDeserializerLogger>(), fieldFilter);
			deserializer.ParentDataStore = new SitecoreDataStore(deserializer);

			using (var db = new Db())
			{
				var itemId = ID.NewID;

				db.Add(new DbItem("Test Item", itemId)
				{
					{ignoredFieldId, "Test Value"}
				});

				var itemData = new ProxyItem(new ItemData(db.GetItem(itemId)));

				var fields = new List<IItemFieldValue>();
				fields.Add(new FakeFieldValue("Changed Ignored Value", fieldId: ignoredFieldId.Guid));
				((ProxyItemVersion)itemData.Versions.First()).Fields = fields;

				deserializer.Deserialize(itemData);

				var fromDb = db.GetItem(itemId);

				Assert.Equal(fromDb[ignoredFieldId], "Test Value");
			}
		}