public void ShouldConstructViewModel()
        {
            // Act
            var viewModelWrapper = _knockoutMapper.ConstructViewModel(typeof(TestViewModel));
            var instance         = _knockoutMapper.GetInstance(viewModelWrapper.RefToken);

            // Assert
            Assert.That(instance["stringProperty"], Is.EqualTo("null"));
        }
        public void ShouldPublishPendingChanges()
        {
            // Arrange
            _knockoutMapper = new KnockoutMapper(_operationRegistryMock.Object, new MonitorCollection());
            var viewModelToken = _knockoutMapper.ConstructViewModel(typeof(TestViewModel)).RefToken;

            // Act
            List <ChangeEntry> changeEntries = null;
            var pollThread = new Thread(() => changeEntries = _knockoutMapper.Subscribe(viewModelToken));

            pollThread.Start();
            TestViewModel.Instance.StringProperty.Set("New string value");
            pollThread.Join();

            // Assert
            Assert.That(changeEntries.Count, Is.EqualTo(1));
            Assert.That(changeEntries[0].PropertyName, Is.EqualTo("StringProperty"));
            Assert.That(changeEntries[0].NewValue, Is.EqualTo("New string value"));
        }
        public void ShouldPublishPendingChanges()
        {
            // Arrange
            _knockoutMapper = new KnockoutMapper(_operationRegistryMock.Object, new MonitorCollection());
            var viewModelToken = _knockoutMapper.ConstructViewModel(typeof(TestViewModel)).RefToken;

            // Act
            List<ChangeEntry> changeEntries = null;
            var pollThread = new Thread(() => changeEntries = _knockoutMapper.Subscribe(viewModelToken));
            pollThread.Start();
            TestViewModel.Instance.StringProperty.Set("New string value");
            pollThread.Join();

            // Assert
            Assert.That(changeEntries.Count, Is.EqualTo(1));
            Assert.That(changeEntries[0].PropertyName, Is.EqualTo("StringProperty"));
            Assert.That(changeEntries[0].NewValue, Is.EqualTo("New string value"));
        }