示例#1
0
        public void DeleteExtractionRequestNoRequestSelected()
        {
            DataRetrievalViewModel sut = new DataRetrievalViewModel(ioServiceMock.Object, xlIOServiceMock.Object, uiControlsServiceMock.Object);

            sut.DataRetrievalRequests = new ObservableCollection <DataRetrievalRequest>(WPFLogicTestsHelper.GenerateMockRequests());

            sut.DeleteExtractionRequestCommand.Execute(null);

            uiControlsServiceMock.Verify(x => x.DisplayAlert("No data retrieval request selected", MessageType.Error), Times.Once());
            Assert.That(sut.DataRetrievalRequests.Count, Is.EqualTo(3));
        }
示例#2
0
        public void DeleteExtractionRequestValidTest()
        {
            DataRetrievalViewModel sut = new DataRetrievalViewModel(ioServiceMock.Object, xlIOServiceMock.Object, uiControlsServiceMock.Object);

            sut.DataRetrievalRequests        = new ObservableCollection <DataRetrievalRequest>(WPFLogicTestsHelper.GenerateMockRequests());
            sut.SelectedDataRetrievalRequest = sut.DataRetrievalRequests[1];

            sut.DeleteExtractionRequestCommand.Execute(null);

            Assert.That(sut.DataRetrievalRequests.Count, Is.EqualTo(2));
            Assert.That(sut.DataRetrievalRequests[0].FieldName, Is.EqualTo("MockFieldName0"));
            Assert.That(sut.DataRetrievalRequests[1].FieldName, Is.EqualTo("MockFieldName2"));
        }