Ejemplo n.º 1
0
        public void OnViewModelCreated()
        {
            AuditingManager.Clear();

            var auditor = new TestAuditor();
            AuditingManager.RegisterAuditor(auditor);

            var viewModel = new TestViewModel();

            Assert.AreEqual(true, auditor.OnViewModelCreatedCalled);
            Assert.AreEqual(typeof (TestViewModel), auditor.OnViewModelCreatedType);
        }
Ejemplo n.º 2
0
        public void OnPropertyChanged()
        {
            AuditingManager.Clear();

            var auditor = new TestAuditor();
            AuditingManager.RegisterAuditor(auditor);

            var viewModel = new TestViewModel();
            viewModel.TestProperty = "test";

            Assert.AreEqual(true, auditor.OnPropertyChangedCalled);
            Assert.AreEqual(viewModel, auditor.OnPropertyChangedViewModel);
            Assert.AreEqual("TestProperty", auditor.OnPropertyChangedPropertyName);
            Assert.AreEqual("test", auditor.OnPropertyChangedNewValue);
        }
Ejemplo n.º 3
0
        public void OnPropertyChanging()
        {
            AuditingManager.Clear();

            var auditor = new TestAuditor();
            AuditingManager.RegisterAuditor(auditor);

            var viewModel = new TestViewModel();
            viewModel.TestProperty = "test";

            Assert.AreEqual(true, auditor.OnPropertyChangingCalled);
            Assert.AreEqual(viewModel, auditor.OnPropertyChangingViewModel);
            Assert.AreEqual("TestProperty", auditor.OnPropertyChangingPropertyName);
            Assert.AreEqual("defaultvalue", auditor.OnPropertyChangingOldValue);
        }
Ejemplo n.º 4
0
        public void OnCommandExecuted()
        {
            AuditingManager.Clear();

            var auditor = new TestAuditor();
            AuditingManager.RegisterAuditor(auditor);

            var viewModel = new TestViewModel();
            viewModel.TestCommand.Execute("test");

            Assert.AreEqual(true, auditor.OnCommandExecutedCalled);
            Assert.AreEqual(viewModel, auditor.OnCommandExecutedViewModel);
            Assert.AreEqual("TestCommand", auditor.OnCommandExecutedCommandName);
            Assert.AreEqual(viewModel.TestCommand, auditor.OnCommandExecutedCommand);
            Assert.AreEqual("test", auditor.OnCommandExecutedCommandParameter);
        }
Ejemplo n.º 5
0
        public void OnPropertyChanged_IgnoredProperties()
        {
            AuditingManager.Clear();

            var auditor = new TestAuditor();
            auditor.PropertiesToIgnore.Add("TestProperty");
            AuditingManager.RegisterAuditor(auditor);

            var viewModel = new TestViewModel();
            viewModel.TestProperty = "test";

            Assert.AreEqual(false, auditor.OnPropertyChangedCalled);
            Assert.AreEqual(null, auditor.OnPropertyChangedViewModel);
            Assert.AreEqual(null, auditor.OnPropertyChangedPropertyName);
            Assert.AreEqual(null, auditor.OnPropertyChangedNewValue);
        }
Ejemplo n.º 6
0
        public async void OnViewModelClosed()
        {
            AuditingManager.Clear();

            var auditor = new TestAuditor();
            AuditingManager.RegisterAuditor(auditor);

            var viewModel = new TestViewModel();
            await viewModel.CloseViewModel(null);

            Assert.AreEqual(true, auditor.OnViewModelClosedCalled);
            Assert.AreEqual(viewModel, auditor.OnViewModelClosedViewModel);
        }
Ejemplo n.º 7
0
        public void OnViewModelCanceled()
        {
            AuditingManager.Clear();

            var auditor = new TestAuditor();
            AuditingManager.RegisterAuditor(auditor);

            var viewModel = new TestViewModel();
            viewModel.CancelViewModel();

            Assert.AreEqual(true, auditor.OnViewModelCanceledCalled);
            Assert.AreEqual(viewModel, auditor.OnViewModelCanceledViewModel);
        }
Ejemplo n.º 8
0
        public void OnViewModelSaving()
        {
            AuditingManager.Clear();

            var auditor = new TestAuditor();
            AuditingManager.RegisterAuditor(auditor);

            var viewModel = new TestViewModel();
            viewModel.SaveViewModel();

            Assert.AreEqual(true, auditor.OnViewModelSavingCalled);
            Assert.AreEqual(viewModel, auditor.OnViewModelSavingViewModel);
        }
Ejemplo n.º 9
0
        public async Task OnViewModelCanceling()
        {
            AuditingManager.Clear();

            var auditor = new TestAuditor();
            AuditingManager.RegisterAuditor(auditor);

            var viewModel = new TestViewModel();
            await viewModel.CancelViewModelAsync();

            Assert.AreEqual(true, auditor.OnViewModelCancelingCalled);
            Assert.AreEqual(viewModel, auditor.OnViewModelCancelingViewModel);
        }