Ejemplo n.º 1
0
        public void RecorderWithSerializationManagerWillUseCustomSerializers()
        {
            // Arrange...
            var db = new Mock<IHistoryContext>();
            var serializationManager = new ValueTranslationManager(db.Object);
            var recorder = new Recorder<ChangeSet, User>(new ChangeSetFactory(), serializationManager);
            var value = new byte[] { 0x01, 0x02, 0x03 };
            var a = new TestClass() { Id = 1 };

            // Act...
            recorder.Record(a, () => a.Id.ToString(), "Property", () => value);
            var set = recorder.Bake(now, author);

            // Assert...
            Assert.AreEqual(1, set.ObjectChanges.Count());
            var objectChange = set.ObjectChanges.Single();
            Assert.AreEqual(1, objectChange.PropertyChanges.Count());
            var propertyChange = objectChange.PropertyChanges.Single();
            Assert.AreNotEqual(value.ToString(), propertyChange.Value);
        }