예제 #1
0
        public void OnFailingSaver_ShouldDisplayErrorMessage()
        {
            string randomErrorMessage = CreateRandom.String();

            _saver.Setup(x => x.SaveStringToFile(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Throws(new Exception(randomErrorMessage));
            GenericPlcViewModel viewModel = CreateGenericPlcViewModel();

            viewModel.Export();
            _states.Verify(s => s.ChangeToErrorState(It.Is <string>(x => x.Contains(randomErrorMessage))));
        }
예제 #2
0
        public void ShouldSaveExportedValue()
        {
            string exportedTree = CreateRandom.String();

            _informationProvider.Setup(x => x.Export(_randomModule)).Returns(Task.FromResult(exportedTree));
            GenericPlcViewModel viewModel = CreateGenericPlcViewModel(moduleName: _randomModule);

            viewModel.Export();
            _saver.Verify(x => x.SaveStringToFile(exportedTree, _randomModule, ".xml"));
        }
예제 #3
0
        public void ShouldDisplayFeedbackDialog()
        {
            string exportedTree = CreateRandom.String();

            _informationProvider.Setup(x => x.Export(_randomModule)).Returns(Task.FromResult(exportedTree));
            _saver.Setup(x => x.SaveStringToFile(exportedTree, _randomModule, ".xml")).Returns(Task.FromResult(true));
            GenericPlcViewModel viewModel = CreateGenericPlcViewModel(moduleName: _randomModule);

            viewModel.Export();
            viewModel.ExportResultViewModel.IsVisible.Should().BeTrue();
        }