public void HasChangesShouldNotGetValueFromStateManagerNotSupportChangeDetection()
        {
            bool isInvoked = false;
            var entity = new object();
            var mock = new EntitySnapshotMock
            {
                HasChanges = o =>
                {
                    isInvoked = true;
                    return false;
                },
                SupportChangeDetection = false
            };
            StateManager.CreateSnapshot = o => mock;

            var viewModel = GetViewModel<TestEditableViewModel>();
            viewModel.InitializeEntity(entity, false);
            viewModel.HasChanges.ShouldBeFalse();
            isInvoked.ShouldBeFalse();
        }
 public void CancelChangesShouldCancelStateUsingStateManager()
 {
     bool isInvoked = false;
     var mock = new EntitySnapshotMock
     {
         Restore = o => isInvoked = true
     };
     StateManager.CreateSnapshot = o => mock;
     var viewModel = GetViewModel<TestEditableViewModel>();
     viewModel.InitializeEntity(new object(), true);
     viewModel.CancelChanges();
     isInvoked.ShouldBeTrue();
 }
        public void HasChangesShouldGetValueFromStateManagerSupportChangeDetection()
        {
            bool stateValue = false;
            var entity = new object();
            var mock = new EntitySnapshotMock
            {
                HasChanges = o => stateValue,
                SupportChangeDetection = true
            };
            StateManager.CreateSnapshot = o => mock;

            var viewModel = GetViewModel<TestEditableViewModel>();
            viewModel.InitializeEntity(entity, false);
            viewModel.HasChanges.ShouldBeFalse();
            stateValue = true;
            viewModel.HasChanges.ShouldBeTrue();
        }