Beispiel #1
0
        static ExchangeNewEmailDesignerViewModel CreateNewViewModel(IShellViewModel shellViewModel, ModelItem modelItem, IExchangeServiceModel model, IEventAggregator eve)
        {
            var mockActiveDataList      = SetupActiveDataList();
            var mockServer              = new Mock <IServer>();
            var mockStudioUpdateManager = new Mock <IStudioUpdateManager>();

            mockServer.SetupGet(it => it.UpdateRepository).Returns(mockStudioUpdateManager.Object);
            var mockQueryManager = new Mock <IQueryManager>();

            var mockExchangeServiceModel = new Mock <IExchangeServiceModel>();

            mockExchangeServiceModel.Setup(a => a.RetrieveSources()).Returns(new ObservableCollection <IExchangeSource> {
                new ExchangeSourceDefinition {
                    Id = Guid.NewGuid()
                }
            });

            mockQueryManager.Setup(query => query.FetchExchangeSources()).Returns(new ObservableCollection <IExchangeSource> {
                new ExchangeSourceDefinition {
                    Id = Guid.NewGuid()
                }
            });
            mockServer.SetupGet(it => it.QueryProxy).Returns(mockQueryManager.Object);
            ServerRepository.Instance.ActiveServer = mockServer.Object;

            var testEmailDesignerViewModel = new ExchangeNewEmailDesignerViewModel(modelItem, new AsyncWorker(), mockServer.Object, eve, shellViewModel, mockActiveDataList.Object);

            testEmailDesignerViewModel.SourceRegion.SelectedSource = model.RetrieveSources().First();

            return(testEmailDesignerViewModel);
        }
Beispiel #2
0
        static ExchangeNewEmailDesignerViewModel CreateViewModel(IShellViewModel shellViewModel, ModelItem modelItem, IExchangeServiceModel model, IEventAggregator eve)
        {
            var mockActiveDataList         = SetupActiveDataList();
            var testEmailDesignerViewModel = new ExchangeNewEmailDesignerViewModel(modelItem, new AsyncWorker(), model, eve, shellViewModel, mockActiveDataList.Object);

            testEmailDesignerViewModel.SourceRegion.SelectedSource = model.RetrieveSources().First();

            return(testEmailDesignerViewModel);
        }
        static TestExchangeEmailDesignerViewModel CreateViewModel(ModelItem modelItem, IExchangeServiceModel model, IEventAggregator eve)
        {
            var testEmailDesignerViewModel = new TestExchangeEmailDesignerViewModel(modelItem, model, eve)
            {
            };

            testEmailDesignerViewModel.SourceRegion.SelectedSource = model.RetrieveSources().First();

            return(testEmailDesignerViewModel);
        }
        static TestExchangeEmailDesignerViewModel CreateViewModel(ModelItem modelItem, IExchangeServiceModel model, IEventAggregator eve)
        {
            var testEmailDesignerViewModel = new TestExchangeEmailDesignerViewModel(modelItem, model, eve)
            {
                GetDatalistString = () =>
                {
                    const string trueString = "True";
                    const string noneString = "None";
                    var          datalist   = string.Format("<DataList><var Description=\"\" IsEditable=\"{0}\" ColumnIODirection=\"{1}\" /><a Description=\"\" IsEditable=\"{0}\" ColumnIODirection=\"{1}\" /><b Description=\"\" IsEditable=\"{0}\" ColumnIODirection=\"{1}\" /><h Description=\"\" IsEditable=\"{0}\" ColumnIODirection=\"{1}\" /><r Description=\"\" IsEditable=\"{0}\" ColumnIODirection=\"{1}\" /><rec Description=\"\" IsEditable=\"{0}\" ColumnIODirection=\"{1}\" ><set Description=\"\" IsEditable=\"{0}\" ColumnIODirection=\"{1}\" /></rec></DataList>", trueString, noneString);
                    return(datalist);
                }
            };

            testEmailDesignerViewModel.SourceRegion.SelectedSource = model.RetrieveSources().First();

            return(testEmailDesignerViewModel);
        }
Beispiel #5
0
        public ExchangeSourceRegion(IExchangeServiceModel model, ModelItem modelItem, string type)
        {
            LabelWidth        = 70;
            ToolRegionName    = "ExchangeSourceRegion";
            Dependants        = new List <IToolRegion>();
            NewSourceCommand  = new DelegateCommand(o => model.CreateNewSource());
            EditSourceCommand = new DelegateCommand(o => model.EditSource(SelectedSource), o => CanEditSource());
            var sources = model.RetrieveSources().OrderBy(source => source.ResourceName);

            Sources    = sources.Where(source => source != null && source.ResourceType == type).ToObservableCollection();
            IsEnabled  = true;
            _modelItem = modelItem;
            SourceId   = modelItem.GetProperty <Guid>("SourceId");

            if (SavedSource != null)
            {
                SelectedSource = Sources.FirstOrDefault(source => source.ResourceID == SavedSource.ResourceID);
            }
        }