public void UnregisterAuditor_UnregisterNotExisting()
        {
            AuditingManager.Clear();

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

            Assert.AreEqual(0, AuditingManager.RegisteredAuditorsCount);
        }
Beispiel #2
0
        public void UnregisterAuditor_UnregisterNotExisting()
        {
            AuditingManager.Clear();

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

            Assert.AreEqual(0, AuditingManager.RegisteredAuditorsCount);
        }
Beispiel #3
0
        public void RegisterAuditor_ValidAuditor()
        {
            AuditingManager.Clear();

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

            Assert.AreEqual(1, AuditingManager.RegisteredAuditorsCount);
        }
        public void RegisterAuditor_ValidAuditor()
        {
            AuditingManager.Clear();

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

            Assert.AreEqual(1, AuditingManager.RegisteredAuditorsCount);
        }
Beispiel #5
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);
        }
Beispiel #6
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);
        }
Beispiel #7
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);
        }
Beispiel #8
0
        public async void OnViewModelSaving()
        {
            AuditingManager.Clear();

            var auditor = new TestAuditor();

            AuditingManager.RegisterAuditor(auditor);

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

            Assert.AreEqual(true, auditor.OnViewModelSavingCalled);
            Assert.AreEqual(viewModel, auditor.OnViewModelSavingViewModel);
        }
Beispiel #9
0
        public async Task 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);
        }
Beispiel #10
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);
        }
Beispiel #11
0
        public void UnregisterAuditor_UnregisterNotExistingWithAnotherRegistered()
        {
            AuditingManager.Clear();

            var auditor1 = new TestAuditor();
            var auditor2 = new TestAuditor();

            AuditingManager.RegisterAuditor(auditor1);

            Assert.AreEqual(1, AuditingManager.RegisteredAuditorsCount);

            AuditingManager.UnregisterAuditor(auditor2);

            Assert.AreEqual(1, AuditingManager.RegisteredAuditorsCount, "Count should still be 1");
        }
Beispiel #12
0
        public void OnViewModelClosing()
        {
            AuditingManager.Clear();

            var auditor = new TestAuditor();

            AuditingManager.RegisterAuditor(auditor);

            var viewModel = new TestViewModel();

            viewModel.CloseViewModel(null);

            Assert.AreEqual(true, auditor.OnViewModelClosingCalled);
            Assert.AreEqual(viewModel, auditor.OnViewModelClosingViewModel);
        }
Beispiel #13
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);
        }
Beispiel #14
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);
        }
Beispiel #15
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);
        }
Beispiel #16
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);
        }
Beispiel #17
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);
        }
Beispiel #18
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);
        }
Beispiel #19
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);
        }
Beispiel #20
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);
        }
Beispiel #21
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);
        }
Beispiel #22
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);
        }
Beispiel #23
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);
        }
Beispiel #24
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);
        }
        public void UnregisterAuditor_UnregisterNotExistingWithAnotherRegistered()
        {
            AuditingManager.Clear();

            var auditor1 = new TestAuditor();
            var auditor2 = new TestAuditor();

            AuditingManager.RegisterAuditor(auditor1);

            Assert.AreEqual(1, AuditingManager.RegisteredAuditorsCount);

            AuditingManager.UnregisterAuditor(auditor2);

            Assert.AreEqual(1, AuditingManager.RegisteredAuditorsCount, "Count should still be 1");
        }