• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# DataList.DataListViewModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Dev2.Studio.ViewModels.DataList.DataListViewModel的典型用法代码示例。如果您正苦于以下问题:C# DataListViewModel类的具体用法?C# DataListViewModel怎么用?C# DataListViewModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DataListViewModel类属于Dev2.Studio.ViewModels.DataList命名空间,在下文中一共展示了DataListViewModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Init

        public void Init()
        {
            PrivateType p = new PrivateType(typeof(Dev2DataLanguageParser));
            var cache = p.GetStaticField("_expressionCache") as ConcurrentDictionary<string, IList<IIntellisenseResult>>;
            Assert.IsNotNull(cache);
            cache.Clear();
            var cache2 = p.GetStaticField("_payloadCache") as ConcurrentDictionary<Tuple<string, string>, IList<IIntellisenseResult>>;
            Assert.IsNotNull(cache2);
            cache2.Clear();
            Monitor.Enter(DataListSingletonTest.DataListSingletonTestGuard);

            var testEnvironmentModel = ResourceModelTest.CreateMockEnvironment();

            _resourceModel = new ResourceModel(testEnvironmentModel.Object)
            {
                ResourceName = "test",
                ResourceType = ResourceType.Service,
                DataList = @"
            <DataList>
                    <Scalar/>
                    <Country/>
                    <State />
                    <City>
                        <Name/>
                        <GeoLocation />
                    </City>
             </DataList>
            "
            };

            IDataListViewModel setupDatalist = new DataListViewModel();
            DataListSingleton.SetDataList(setupDatalist);
            DataListSingleton.ActiveDataList.InitializeDataListViewModel(_resourceModel);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:34,代码来源:DefaultIntellisenseProviderTest.cs


示例2: Init

        public void Init()
        {
            Monitor.Enter(DataListSingletonTest.DataListSingletonTestGuard);

            var testEnvironmentModel = ResourceModelTest.CreateMockEnvironment();

            _resourceModel = new ResourceModel(testEnvironmentModel.Object)
            {
                ResourceName = "test",
                ResourceType = ResourceType.Service,
                DataList = @"
            <DataList>
                    <Scalar/>
                    <Country/>
                    <State />
                    <City>
                        <Name/>
                        <GeoLocation />
                    </City>
             </DataList>
            "
            };

            IDataListViewModel setupDatalist = new DataListViewModel();
            DataListSingleton.SetDataList(setupDatalist);
            DataListSingleton.ActiveDataList.InitializeDataListViewModel(_resourceModel);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:27,代码来源:WebsiteCallbackHandlerTests.cs


示例3: CreateDataListViewModel

        internal IDataListViewModel CreateDataListViewModel(IResourceModel resourceModel)
        {
            DataListViewModel dLVM = new DataListViewModel();
            dLVM.InitializeDataListViewModel(resourceModel);

            return dLVM;
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:7,代码来源:DataListViewModelTestHelper.cs


示例4: CreateDataListViewModelWithDefaultResourceModel

        internal IDataListViewModel CreateDataListViewModelWithDefaultResourceModel() {
            TestResourceModel testResourceModel = new TestResourceModel();
            IDataListViewModel dataListViewModel = new DataListViewModel();
            dataListViewModel.InitializeDataListViewModel(testResourceModel);

            return dataListViewModel;
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:7,代码来源:DataListViewModelTestHelper.cs


示例5: ZipDesignerViewModel_Validate_CorrectFieldsAreValidated

 public void ZipDesignerViewModel_Validate_CorrectFieldsAreValidated()
 {
     //------------Setup for test-------------------------
     var dataListViewModel = new DataListViewModel();
     dataListViewModel.InitializeDataListViewModel(new ResourceModel(null));
     DataListSingleton.SetDataList(dataListViewModel);
     var viewModel = ZipViewModel();
     //------------Execute Test---------------------------
     viewModel.Validate();
     //------------Assert Results-------------------------            
     Assert.AreEqual(1, viewModel.ValidateInputPathHitCount);
     Assert.AreEqual(1, viewModel.ValidateUserNameAndPasswordHitCount);
     Assert.AreEqual(1, viewModel.ValidateDestinationUsernameAndPasswordHitCount);
 }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:14,代码来源:ZipDesignerViewModelTests.cs


示例6: GivenIHaveTheFollowingVariableList

        public void GivenIHaveTheFollowingVariableList(string variableList)
        {
            const string Root = "<DataList>##</DataList>";
            var datalist = Root.Replace("##", variableList);
            ScenarioContext.Current.Add("dataList", datalist);

            var testEnvironmentModel = ResourceModelTest.CreateMockEnvironment();

            var resourceModel = new ResourceModel(testEnvironmentModel.Object)
            {
                ResourceName = "test",
                ResourceType = ResourceType.Service,
                DataList = datalist
            };

            IDataListViewModel setupDatalist = new DataListViewModel();
            DataListSingleton.SetDataList(setupDatalist);
            DataListSingleton.ActiveDataList.InitializeDataListViewModel(resourceModel);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:19,代码来源:IntellisenseProviderSteps.cs


示例7: Setup

        void Setup()
        {

            //_mockMediatorRepo = new Mock<IMediatorRepo>();
            _mockResourceModel = Dev2MockFactory.SetupResourceModelMock();

            //_mockMediatorRepo.Setup(c => c.addKey(It.IsAny<Int32>(), It.IsAny<MediatorMessages>(), It.IsAny<String>()));
            //_mockMediatorRepo.Setup(c => c.deregisterAllItemMessages(It.IsAny<Int32>()));
            _dataListViewModel = new DataListViewModel(new Mock<IEventAggregator>().Object);
            _dataListViewModel.InitializeDataListViewModel(_mockResourceModel.Object);
            //Mock<IMainViewModel> _mockMainViewModel = Dev2MockFactory.SetupMainViewModel();
            _dataListViewModel.RecsetCollection.Clear();
            _dataListViewModel.ScalarCollection.Clear();

            IDataListItemModel carRecordset = DataListItemModelFactory.CreateDataListModel("Car", "A recordset of information about a car", enDev2ColumnArgumentDirection.Both);
            carRecordset.Children.Add(DataListItemModelFactory.CreateDataListModel("Make", "Make of vehicle", carRecordset));
            carRecordset.Children.Add(DataListItemModelFactory.CreateDataListModel("Model", "Model of vehicle", carRecordset));

            _dataListViewModel.RecsetCollection.Add(carRecordset);
            _dataListViewModel.ScalarCollection.Add(DataListItemModelFactory.CreateDataListModel("Country", "name of Country", enDev2ColumnArgumentDirection.Both));

            DataListSingleton.SetDataList(_dataListViewModel);
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:23,代码来源:DataListViewModelTests.cs


示例8: WriteResourceModel_DataListContainingScalarWithError_WithDoubleBracketedScalar_Expected_Positive

        public void WriteResourceModel_DataListContainingScalarWithError_WithDoubleBracketedScalar_Expected_Positive()
        {

            //------------Setup for test--------------------------

            _mockResourceModel = Dev2MockFactory.SetupResourceModelMock();

            _dataListViewModel = new DataListViewModel(new Mock<IEventAggregator>().Object);
            _dataListViewModel.InitializeDataListViewModel(_mockResourceModel.Object);
            _dataListViewModel.RecsetCollection.Clear();
            _dataListViewModel.ScalarCollection.Clear();

            IDataListItemModel carRecordset = DataListItemModelFactory.CreateDataListModel("[[Car]]", "A recordset of information about a car", enDev2ColumnArgumentDirection.Both);
            carRecordset.Children.Add(DataListItemModelFactory.CreateDataListModel("Make", "Make of vehicle", carRecordset));
            carRecordset.Children.Add(DataListItemModelFactory.CreateDataListModel("Model", "Model of vehicle", carRecordset));

            _dataListViewModel.RecsetCollection.Add(carRecordset);
            var scalarDataListItemWithError = DataListItemModelFactory.CreateDataListModel("[[Country]]", "name of Country", enDev2ColumnArgumentDirection.Both);
            scalarDataListItemWithError.HasError = true;
            scalarDataListItemWithError.ErrorMessage = "This is an Error";
            _dataListViewModel.ScalarCollection.Add(scalarDataListItemWithError);
            _dataListViewModel.ScalarCollection.Add(scalarDataListItemWithError);
            _dataListViewModel.ValidateNames(scalarDataListItemWithError);
            DataListSingleton.SetDataList(_dataListViewModel);
            //------------Execute Test---------------------------
            var xmlDataList = _dataListViewModel.WriteToResourceModel();
            //------------Assert Results-------------------------
            Assert.AreEqual(2, _dataListViewModel.ScalarCollection.Count);
            Assert.IsTrue(_dataListViewModel.ScalarCollection[0].DisplayName == "Country");
            Assert.IsTrue(_dataListViewModel.ScalarCollection[1].DisplayName == "Country");
            Assert.IsFalse(xmlDataList.Contains("Country"));
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:32,代码来源:DataListViewModelTests.cs


示例9: DataListViewModel_MissingDataListParts_WithRecsetPartNotInDataList_ShouldReturnPartInList

 public void DataListViewModel_MissingDataListParts_WithRecsetPartNotInDataList_ShouldReturnPartInList()
 {
     //------------Setup for test--------------------------
     var dataListViewModel = new DataListViewModel(new Mock<IEventAggregator>().Object);
     const string recsetName = "recset";
     const string firstFieldName = "f1";
     var dataListParts = new List<IDataListVerifyPart>();
     var part = CreateRecsetPart(recsetName, firstFieldName);
     dataListParts.Add(part.Object);
     //----------------------Precondition----------------------------
     //------------Execute Test---------------------------
     List<IDataListVerifyPart> missingDataListParts = dataListViewModel.MissingDataListParts(dataListParts);
     //------------Assert Results-------------------------
     Assert.AreEqual(1, missingDataListParts.Count);
 }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:15,代码来源:DataListViewModelTests.cs


示例10: CreateServiceDesignerViewModelWithEmptyResourceID

        static ServiceDesignerViewModel CreateServiceDesignerViewModelWithEmptyResourceID(Guid instanceID, params IErrorInfo[] resourceErrors)
        {
            var rootModel = CreateResourceModel(Guid.NewGuid(), false, resourceErrors);
            rootModel.Setup(model => model.ResourceType).Returns(Studio.Core.AppResources.Enums.ResourceType.WorkflowService);
            var resourceModel = CreateResourceModel(Guid.Empty, false);
            resourceModel.Setup(model => model.ResourceType).Returns(Studio.Core.AppResources.Enums.ResourceType.WorkflowService);
            resourceModel.Setup(model => model.DataList).Returns("<DataList><n1/></DataList>");
            resourceModel.Setup(model => model.ResourceName).Returns("TestResource");

            var dataListViewModel = new DataListViewModel();
            dataListViewModel.InitializeDataListViewModel(resourceModel.Object);
            dataListViewModel.ScalarCollection.Add(new DataListItemModel("n1"));
            DataListSingleton.SetDataList(dataListViewModel);
            var modelItem = CreateModelItem(instanceID, resourceModel.Object.ID, resourceModel.Object.Environment.ID, null);

            var envRepository = new Mock<IEnvironmentRepository>();
            envRepository.Setup(e => e.ActiveEnvironment).Returns(resourceModel.Object.Environment);
            envRepository.Setup(r => r.FindSingle(It.IsAny<Expression<Func<IEnvironmentModel, bool>>>())).Returns(resourceModel.Object.Environment);
            var worker = new Mock<IAsyncWorker>().Object;
            return new ServiceDesignerViewModel(modelItem.Object, rootModel.Object, envRepository.Object, new Mock<IEventAggregator>().Object, worker);
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:21,代码来源:ServiceDesignerViewModelTests.cs


示例11: DataListViewModel_RemoveDataListItem_WithScalarItem_ShouldRemoveFromScalarCollection

 public void DataListViewModel_RemoveDataListItem_WithScalarItem_ShouldRemoveFromScalarCollection()
 {
     //------------Setup for test--------------------------
     var dataListViewModel = new DataListViewModel(new Mock<IEventAggregator>().Object);
     var scalarItem = new DataListItemModel("scalar");
     dataListViewModel.ScalarCollection.Add(scalarItem);
     //----------------------Precondition----------------------------
     Assert.AreEqual(1, dataListViewModel.ScalarCollection.Count);
     //------------Execute Test---------------------------
     dataListViewModel.RemoveDataListItem(scalarItem);
     //------------Assert Results-------------------------
     Assert.AreEqual(0, dataListViewModel.ScalarCollection.Count);
 }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:13,代码来源:DataListViewModelTests.cs


示例12: ServiceDesignerViewModel_WhenRemoteEnvironmentLoads_ShouldUseNameToFindEnvironment

        public void ServiceDesignerViewModel_WhenRemoteEnvironmentLoads_ShouldUseNameToFindEnvironment()
        {
            //------------Setup for test--------------------------
            var resourceID = Guid.Empty;

            var connection = new Mock<IEnvironmentConnection>();
            connection.Setup(conn => conn.ServerEvents).Returns(new EventPublisher());

            var environmentID = Guid.NewGuid();


            var environment = new Mock<IEnvironmentModel>();
            environment.Setup(e => e.Connection).Returns(connection.Object);
            environment.Setup(e => e.ID).Returns(environmentID);
            environment.Setup(e => e.IsConnected).Returns(true);
            environment.Setup(model => model.IsLocalHost).Returns(false);
            environment.Setup(e => e.IsLocalHostCheck()).Returns(false);

            var errors = new ObservableReadOnlyList<IErrorInfo>();

            var resourceModel = new Mock<IContextualResourceModel>();
            resourceModel.Setup(r => r.ResourceName).Returns("TestResource").Verifiable();
            resourceModel.Setup(r => r.ServerID).Returns(Guid.NewGuid());
            resourceModel.Setup(r => r.WorkflowXaml).Returns(new StringBuilder("<root/>"));
            resourceModel.Setup(m => m.Errors).Returns(errors);
            resourceModel.Setup(m => m.ID).Returns(resourceID);
            resourceModel.Setup(m => m.Environment).Returns(environment.Object);
            resourceModel.Setup(m => m.GetErrors(It.IsAny<Guid>())).Returns(errors);
            resourceModel.Setup(m => m.HasErrors).Returns(() => false);
            resourceModel.SetupProperty(m => m.IsValid);
            resourceModel.Setup(m => m.RemoveError(It.IsAny<IErrorInfo>())).Callback((IErrorInfo error) => errors.Remove(error));

            resourceModel.Setup(model => model.DataList).Returns("<DataList><n1/></DataList>");

            var resources = new Mock<IResourceRepository>();

            environment.Setup(a => a.ResourceRepository).Returns(resources.Object);
            var dataListViewModel = new DataListViewModel();
            dataListViewModel.InitializeDataListViewModel(resourceModel.Object);
            dataListViewModel.ScalarCollection.Add(new DataListItemModel("n1"));
            DataListSingleton.SetDataList(dataListViewModel);

            var rootModel = CreateResourceModel(resourceID);

            var envRepository = new Mock<IEnvironmentRepository>();
            envRepository.Setup(r => r.FindSingle(It.IsAny<Expression<Func<IEnvironmentModel, bool>>>())).Returns(resourceModel.Object.Environment);
            envRepository.Setup(r => r.ActiveEnvironment).Returns(resourceModel.Object.Environment);

            var activity = new DsfActivity
            {
                ServiceName = "bob",
                ResourceID = new InArgument<Guid>(resourceID),
                EnvironmentID = new InArgument<Guid>(Guid.Empty),
                UniqueID = Guid.Empty.ToString(),
                SimulationMode = SimulationMode.OnDemand,
                InputMapping = "<Inputs><Input Name=\"n1\" Source=\"[[n1]]\" /></Inputs>",
                OutputMapping = "<Outputs><Output Name=\"n1\" MapsTo=\"[[n1]]\" Value=\"[[n1]]\" /></Outputs>"
            };

            var modelItem = CreateModelItem(activity);
            var worker = new Mock<IAsyncWorker>();
            // ReSharper disable MaximumChainedReferences
            worker.Setup(a => a.Start(It.IsAny<System.Action>(), It.IsAny<System.Action>()))
                .Callback((System.Action a, System.Action b) =>
                // ReSharper restore MaximumChainedReferences
                {
                    a.Invoke();
                    b.Invoke();
                }
                );
            //------------Execute Test---------------------------
            // ReSharper disable UnusedVariable


            var viewModel = new ServiceDesignerViewModel(modelItem, rootModel.Object, envRepository.Object, new Mock<IEventAggregator>().Object, worker.Object);
            var webFact = new Mock<IWebActivityFactory>();
            var wa = new Mock<IWebActivity>();
            // ReSharper disable MaximumChainedReferences
            webFact.Setup(
                a => a.CreateWebActivity(It.IsAny<Object>(), It.IsAny<IContextualResourceModel>(), It.IsAny<string>())).Returns(wa.Object).Verifiable();
            // ReSharper restore MaximumChainedReferences
            viewModel.ActivityFactory = webFact.Object;

            var mappingF = new Mock<IDataMappingViewModelFactory>();
            var mapping = new Mock<IDataMappingViewModel>();
            mapping.Setup(a => a.GetOutputString(It.IsAny<IList<IInputOutputViewModel>>())).Returns("bob");
            // ReSharper disable once MaximumChainedReferences
            mappingF.Setup(a => a.CreateModel(It.IsAny<IWebActivity>(), It.IsAny<NotifyCollectionChangedEventHandler>()))
                    .Returns(mapping.Object);
            viewModel.MappingFactory = mappingF.Object;

            // ReSharper restore UnusedVariable
            // ReSharper disable MaximumChainedReferences
            // ReSharper disable MaximumChainedReferences
            resources.Setup(a => a.FindSingle(It.IsAny<Expression<Func<IResourceModel, bool>>>(), true, false))
                .Returns(resourceModel.Object)
                .Callback((Expression<Func<IResourceModel, bool>> expression, bool b) => Assert.IsTrue(expression.ToString().Contains("c => (c.ResourceName == ")))

                .Verifiable();
            // ReSharper restore MaximumChainedReferences
//.........这里部分代码省略.........
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:101,代码来源:ServiceDesignerViewModelTests.cs


示例13: ServiceDesingerViewModel_SetRunWorkflowAsync_True_OutputMappingEnabledFalse

        public void ServiceDesingerViewModel_SetRunWorkflowAsync_True_OutputMappingEnabledFalse()
        {
            //------------Setup for test--------------------------
            var resourceID = Guid.NewGuid();

            var resourceModel = CreateResourceModel(Guid.Empty, false);
            resourceModel.Setup(model => model.DataList).Returns("<DataList><n1/></DataList>");
            var dataListViewModel = new DataListViewModel();
            dataListViewModel.InitializeDataListViewModel(resourceModel.Object);
            dataListViewModel.ScalarCollection.Add(new DataListItemModel("n1"));
            DataListSingleton.SetDataList(dataListViewModel);

            var rootModel = CreateResourceModel(Guid.Empty);

            var envRepository = new Mock<IEnvironmentRepository>();
            envRepository.Setup(r => r.FindSingle(It.IsAny<Expression<Func<IEnvironmentModel, bool>>>())).Returns(resourceModel.Object.Environment);
            envRepository.Setup(r => r.ActiveEnvironment).Returns(resourceModel.Object.Environment);

            var activity = new DsfActivity { ResourceID = new InArgument<Guid>(resourceID), EnvironmentID = new InArgument<Guid>(Guid.Empty), UniqueID = Guid.NewGuid().ToString(), SimulationMode = SimulationMode.OnDemand };

            var modelItem = CreateModelItem(activity);
            var viewModel = new ServiceDesignerViewModel(modelItem, rootModel.Object, envRepository.Object, new Mock<IEventAggregator>().Object) { RunWorkflowAsync = true };
            //------------Execute Test---------------------------
            //------------Assert Results-------------------------
            Assert.IsTrue(viewModel.RunWorkflowAsync);
            Assert.IsFalse(viewModel.OutputMappingEnabled);
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:27,代码来源:ServiceDesignerViewModelTests.cs


示例14: ServiceDesignerViewModel_WhenResourceHasSource_ShouldGetSourceName

        public void ServiceDesignerViewModel_WhenResourceHasSource_ShouldGetSourceName()
        {
            //------------Setup for test--------------------------
            var resourceID = Guid.NewGuid();

            var connection = new Mock<IEnvironmentConnection>();
            connection.Setup(conn => conn.ServerEvents).Returns(new EventPublisher());

            var environmentID = Guid.NewGuid();
            var environment = new Mock<IEnvironmentModel>();
            environment.Setup(e => e.Connection).Returns(connection.Object);
            environment.Setup(e => e.ID).Returns(environmentID);
            environment.Setup(e => e.IsConnected).Returns(true);
            environment.Setup(model => model.IsLocalHost).Returns(false);
            environment.Setup(e => e.IsLocalHostCheck()).Returns(false);

            var errors = new ObservableReadOnlyList<IErrorInfo>();

            var resourceModel = new Mock<IContextualResourceModel>();
            resourceModel.Setup(r => r.ResourceName).Returns("TestResource");
            resourceModel.Setup(r => r.ServerID).Returns(Guid.NewGuid());
            resourceModel.Setup(r => r.WorkflowXaml).Returns(new StringBuilder("<root/>"));
            resourceModel.Setup(m => m.Errors).Returns(errors);
            resourceModel.Setup(m => m.ID).Returns(resourceID);
            resourceModel.Setup(m => m.Environment).Returns(environment.Object);
            resourceModel.Setup(m => m.GetErrors(It.IsAny<Guid>())).Returns(errors);
            resourceModel.Setup(m => m.HasErrors).Returns(() => false);
            resourceModel.SetupProperty(m => m.IsValid);
            resourceModel.Setup(m => m.RemoveError(It.IsAny<IErrorInfo>())).Callback((IErrorInfo error) => errors.Remove(error));

            resourceModel.Setup(model => model.DataList).Returns("<DataList><n1/></DataList>");
            var dataListViewModel = new DataListViewModel();
            dataListViewModel.InitializeDataListViewModel(resourceModel.Object);
            dataListViewModel.ScalarCollection.Add(new DataListItemModel("n1"));
            DataListSingleton.SetDataList(dataListViewModel);

            var rootModel = CreateResourceModel(resourceID);

            var envRepository = new Mock<IEnvironmentRepository>();
            envRepository.Setup(r => r.FindSingle(It.IsAny<Expression<Func<IEnvironmentModel, bool>>>())).Returns(resourceModel.Object.Environment);
            envRepository.Setup(r => r.ActiveEnvironment).Returns(resourceModel.Object.Environment);


            var activity = new DsfActivity
            {
                ResourceID = new InArgument<Guid>(resourceID),
                EnvironmentID = new InArgument<Guid>(Guid.Empty),
                UniqueID = Guid.NewGuid().ToString(),
                SimulationMode = SimulationMode.OnDemand,
                InputMapping = "<Inputs><Input Name=\"n1\" Source=\"[[n1]]\" /></Inputs>",
                OutputMapping = "<Outputs><Output Name=\"n1\" MapsTo=\"[[n1]]\" Value=\"[[n1]]\" /></Outputs>"
            };

            var modelItem = CreateModelItem(activity);
            var resRepo = new Mock<IResourceRepository>();
            var srcRes = new Mock<IResourceModel>();
            srcRes.Setup(a => a.DisplayName).Returns("bob");
            resRepo.Setup(a => a.FindSingle(It.IsAny<Expression<Func<IResourceModel, bool>>>(), false, false)).Returns(srcRes.Object);
            environment.Setup(a => a.ResourceRepository).Returns(resRepo.Object);
            //------------Execute Test---------------------------
            var viewModel = new ServiceDesignerViewModel(modelItem, rootModel.Object, envRepository.Object, new Mock<IEventAggregator>().Object);
            //------------Assert Results-------------------------
            Assert.AreEqual("bob", viewModel.Properties.FirstOrDefault(a => a.Key == "Source :").Value);

        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:65,代码来源:ServiceDesignerViewModelTests.cs


示例15: CreateDataListViewModel

 static IDataListViewModel CreateDataListViewModel(Mock<IContextualResourceModel> mockResourceModel, IEventAggregator eventAggregator = null)
 {
     var dataListViewModel = new DataListViewModel(eventAggregator ?? new Mock<IEventAggregator>().Object);
     dataListViewModel.InitializeDataListViewModel(mockResourceModel.Object);
     return dataListViewModel;
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:6,代码来源:WorkflowDesignerUnitTest.cs


示例16: AddRecordSetNamesIfMissing_DataListContainingRecordSet_WithRoundBracketedScalar_Expected_Positive

        public void AddRecordSetNamesIfMissing_DataListContainingRecordSet_WithRoundBracketedScalar_Expected_Positive()
        {

            //------------Setup for test--------------------------

            _mockResourceModel = Dev2MockFactory.SetupResourceModelMock();

            _dataListViewModel = new DataListViewModel(new Mock<IEventAggregator>().Object);
            _dataListViewModel.InitializeDataListViewModel(_mockResourceModel.Object);
            _dataListViewModel.RecsetCollection.Clear();
            _dataListViewModel.ScalarCollection.Clear();

            IDataListItemModel carRecordset = DataListItemModelFactory.CreateDataListModel("[Car]", "A recordset of information about a car", enDev2ColumnArgumentDirection.Both);
            carRecordset.Children.Add(DataListItemModelFactory.CreateDataListModel("Make", "Make of vehicle", carRecordset));
            carRecordset.Children.Add(DataListItemModelFactory.CreateDataListModel("Model", "Model of vehicle", carRecordset));

            _dataListViewModel.RecsetCollection.Add(carRecordset);
            _dataListViewModel.ScalarCollection.Add(DataListItemModelFactory.CreateDataListModel("Country()", "name of Country", enDev2ColumnArgumentDirection.Both));

            DataListSingleton.SetDataList(_dataListViewModel);
            //------------Execute Test---------------------------
            _dataListViewModel.WriteToResourceModel();
            //------------Assert Results-------------------------
            Assert.AreEqual(1, _dataListViewModel.ScalarCollection.Count);
            Assert.IsTrue(_dataListViewModel.ScalarCollection[0].DisplayName == "Country");
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:26,代码来源:DataListViewModelTests.cs


示例17: DataListViewModel_MissingDataListParts_ScalarPartInDataList_ShouldNotReturnPartInList

 public void DataListViewModel_MissingDataListParts_ScalarPartInDataList_ShouldNotReturnPartInList()
 {
     //------------Setup for test--------------------------
     var dataListViewModel = new DataListViewModel(new Mock<IEventAggregator>().Object);
     const string scalarName = "scalar";
     var scalarItem = new DataListItemModel(scalarName);
     dataListViewModel.ScalarCollection.Add(scalarItem);
     var parts = new List<IDataListVerifyPart> { CreateScalarPart(scalarName).Object };
     //----------------------Precondition----------------------------
     Assert.AreEqual(1, dataListViewModel.ScalarCollection.Count);
     //------------Execute Test---------------------------
     List<IDataListVerifyPart> missingDataListParts = dataListViewModel.MissingDataListParts(parts);
     //------------Assert Results-------------------------
     Assert.AreEqual(0, missingDataListParts.Count);
 }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:15,代码来源:DataListViewModelTests.cs


示例18: DataListViewModel_RemoveDataListItem_WithRecsetItem_ShouldRemoveFromRecsetCollection

 public void DataListViewModel_RemoveDataListItem_WithRecsetItem_ShouldRemoveFromRecsetCollection()
 {
     //------------Setup for test--------------------------
     var dataListViewModel = new DataListViewModel(new Mock<IEventAggregator>().Object);
     const string recsetName = "recset";
     const string firstFieldName = "f1";
     var recSetDataModel = CreateRecsetDataListModelWithTwoFields(recsetName, firstFieldName, "f2");
     dataListViewModel.RecsetCollection.Add(recSetDataModel);
     var dataListParts = new List<IDataListVerifyPart>();
     var part = CreateRecsetPart(recsetName, firstFieldName);
     dataListParts.Add(part.Object);
     //----------------------Precondition----------------------------
     Assert.AreEqual(1, dataListViewModel.RecsetCollection.Count);
     //------------Execute Test---------------------------
     dataListViewModel.RemoveDataListItem(recSetDataModel);
     //------------Assert Results-------------------------
     Assert.AreEqual(0, dataListViewModel.RecsetCollection.Count);
 }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:18,代码来源:DataListViewModelTests.cs


示例19: WorkflowDesignerViewModel_BuildDataPart_ValidItem_ShouldAddItemToDataList

        public void WorkflowDesignerViewModel_BuildDataPart_ValidItem_ShouldAddItemToDataList()
        {
            //------------Setup for test--------------------------
            var eventAggregator = new EventAggregator();

            Mock<IContextualResourceModel> mockResourceModel = Dev2MockFactory.SetupResourceModelMock();
            mockResourceModel.Setup(resModel => resModel.WorkflowXaml).Returns(WorkflowXAMLForTest());
            var workflowDesigner = CreateWorkflowDesignerViewModel(eventAggregator, mockResourceModel.Object, null, false);
            var dataListViewModel = new DataListViewModel();
            DataListSingleton.SetDataList(dataListViewModel);
            dataListViewModel.AddBlankRow(null);
            //------------Execute Test---------------------------
            workflowDesigner.Handle(new AddStringListToDataListMessage(new List<string> { "[[rec().set]]", "[[test()]]", "[[scalar]]" }));
            //------------Assert Results-------------------------
            var dataListItemModels = DataListSingleton.ActiveDataList.DataList;
            workflowDesigner.Dispose();
            Assert.AreEqual(5, dataListItemModels.Count);
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:18,代码来源:WorkflowDesignerUnitTest.cs


示例20: DataListViewModel_MissingDataListParts_WithRecsetFieldPartInDataList_ShouldNotReturnPartInList

 public void DataListViewModel_MissingDataListParts_WithRecsetFieldPartInDataList_ShouldNotReturnPartInList()
 {
     //------------Setup for test--------------------------
     var dataListViewModel = new DataListViewModel(new Mock<IEventAggregator>().Object);
     const string recsetName = "recset";
     const string firstFieldName = "f1";
     IDataListItemModel recSetDataModel = DataListItemModelFactory.CreateDataListModel(recsetName, "A recordset of information about a car", enDev2ColumnArgumentDirection.Both);
     IDataListItemModel firstFieldDataListItemModel = CreateFieldDataListModel(firstFieldName, recSetDataModel);
     recSetDataModel.Children.Add(firstFieldDataListItemModel);
     recSetDataModel.Children.Add(CreateFieldDataListModel("f2", recSetDataModel));
     dataListViewModel.RecsetCollection.Add(recSetDataModel);
     var dataListParts = new List<IDataListVerifyPart>();
     var part = CreateRecsetPart(recsetName, firstFieldName);
     dataListParts.Add(part.Object);
     //----------------------Precondition----------------------------
     Assert.AreEqual(2, dataListViewModel.RecsetCollection[0].Children.Count);
     //------------Execute Test---------------------------
     List<IDataListVerifyPart> missingDataListParts = dataListViewModel.MissingDataListParts(dataListParts);
     //------------Assert Results-------------------------
     Assert.AreEqual(0, missingDataListParts.Count);
 }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:21,代码来源:DataListViewModelTests.cs



注:本文中的Dev2.Studio.ViewModels.DataList.DataListViewModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AdvTree.Node类代码示例发布时间:2022-05-24
下一篇:
C# Interfaces.IntellisenseProviderContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap