コード例 #1
0
        public void Edit_CanExecute_WhenNoPatientIsSelected_ReturnsFalse()
        {
            var mockDialogService      = new MockDialogService();
            var mockPatientDataService = new MockPatientDataService();
            var sut = new MainWindowViewModel(mockDialogService, mockPatientDataService);

            var result = sut.Edit.CanExecute(null);

            Assert.IsFalse(result);
        }
コード例 #2
0
        public void Constructor_LoadsAllPatients()
        {
            var mockDialogService      = new MockDialogService();
            var mockPatientDataService = new MockPatientDataService();
            var expected = mockPatientDataService.GetAllPatients();

            var sut    = new MainWindowViewModel(mockDialogService, mockPatientDataService);
            var result = sut.AllPatients.Select(x => x.Model);

            CollectionAssert.AreEqual(expected, result);
        }
コード例 #3
0
        public void Edit_CanExecute_WhenPatientIsSelected_ReturnsTrue()
        {
            var mockDialogService      = new MockDialogService();
            var mockPatientDataService = new MockPatientDataService();
            var sut = new MainWindowViewModel(mockDialogService, mockPatientDataService);

            sut.SelectedPatient = sut.AllPatients.First();

            var result = sut.Edit.CanExecute(null);

            Assert.IsTrue(result);
        }
コード例 #4
0
        public void HandlePatientDeletedMessage_ClosesPatientDetailsDialog()
        {
            var mockDialogService      = new MockDialogService();
            var mockPatientDataService = new MockPatientDataService();
            var sut = new MainWindowViewModel(mockDialogService, mockPatientDataService);
            var dummyPatientViewModel = new PatientViewModel();

            Messenger.Default.Send(new PatientDeleteMessage(dummyPatientViewModel));

            var firstMethocCall = mockDialogService.InvocationList.First();

            Assert.AreEqual(nameof(mockDialogService.CloseDetailsDialog), firstMethocCall);
        }
コード例 #5
0
        public void Edit_Execute_OpensPatientDetailsDialog()
        {
            var mockDialogService      = new MockDialogService();
            var mockPatientDataService = new MockPatientDataService();
            var sut = new MainWindowViewModel(mockDialogService, mockPatientDataService);

            sut.SelectedPatient = sut.AllPatients.First();
            sut.Edit.Execute(null);

            var firstMethocCall = mockDialogService.InvocationList.First();

            Assert.AreEqual(nameof(mockDialogService.ShowDetailsDialog), firstMethocCall);
        }