Exemple #1
0
        static ExchangeNewEmailDesignerViewModel CreateNewViewModel(IShellViewModel shellViewModel, ModelItem modelItem, IEventAggregator eve, bool isemptySource = false)
        {
            var mockModel = new TestExchangeServiceModel(isemptySource);

            mockModel.Sources = mockModel.RetrieveSources();
            return(CreateNewViewModel(shellViewModel, modelItem, mockModel, eve));
        }
Exemple #2
0
        public void ExchangeNewEmailDesignerViewModel_TestEmail_Valid_ReturnsSucccess()
        {
            var modelItem = CreateModelItem();

            var eventPublisher = new Mock <IEventAggregator>();

            eventPublisher.Setup(p => p.Publish(It.IsAny <FileChooserMessage>())).Verifiable();
            var mockShellViewModel = new Mock <IShellViewModel>();

            var viewModel = CreateNewViewModel(mockShellViewModel.Object, modelItem, eventPublisher.Object);
            var mockModel = new TestExchangeServiceModel(true);

            viewModel.SourceRegion = new ExchangeSourceRegion(mockModel, modelItem, "ExchangeSource");

            viewModel.TestEmailAccount();

            Assert.IsFalse(viewModel.Testing);
            Assert.AreEqual("", viewModel.StatusMessage);
            Assert.AreEqual(1, viewModel.Errors.Count);
            Assert.AreEqual("Please select valid source", viewModel.Errors[0].Message);
        }