public static SetupResourceModelMock ( ) : Mock |
||
return | Mock |
public void DeploySummaryPredicateExisting_EnvironmentContainsResourceWithSameIDButDifferentName_ExpectedTrue() { Guid resourceGuid = Guid.NewGuid(); Mock <IContextualResourceModel> mockResourceModel = CreateMockResourceModel(resourceGuid, "OtherResource"); IEnvironmentModel environmentModel; IExplorerItemModel resourceVm; IExplorerItemModel rootItem; StudioResourceRepository studioResourceRepository = CreateModels(false, mockResourceModel, out environmentModel, out resourceVm, out rootItem); Mock <IContextualResourceModel> resourceModel = Dev2MockFactory.SetupResourceModelMock(Studio.Core.AppResources.Enums.ResourceType.WorkflowService, resourceGuid); environmentModel = Dev2MockFactory.SetupEnvironmentModel(resourceModel, new List <IResourceModel>()).Object; var navigationViewModel = CreateDeployNavigationViewModel(environmentModel, studioResourceRepository); ExplorerItemModel explorerItemModel = new ExplorerItemModel { DisplayName = "localhost", ResourceType = ResourceType.Server }; explorerItemModel.Children.Add(resourceVm); navigationViewModel.ExplorerItemModels.Add(explorerItemModel); navigationViewModel.Environment = environmentModel; resourceVm.IsChecked = true; bool actual = DeployStatsCalculator.DeploySummaryPredicateExisting(resourceVm, navigationViewModel); Assert.IsTrue(actual); Assert.IsTrue(DeployStatsCalculator.ConflictingResources.Count > 0); }
public void DataListViewModel_DifferentVariablesCollection_Object_Is_NOT_Equal() { //---------------Set up test pack------------------- var mockResourceModel = Dev2MockFactory.SetupResourceModelMock(); var dataListViewModel = new DataListViewModel(new Mock <IEventAggregator>().Object); var dataListViewModel1 = new DataListViewModel(new Mock <IEventAggregator>().Object); dataListViewModel.InitializeDataListViewModel(mockResourceModel.Object); dataListViewModel1.InitializeDataListViewModel(mockResourceModel.Object); dataListViewModel.RecsetCollection.Clear(); dataListViewModel.ScalarCollection.Clear(); dataListViewModel1.RecsetCollection.Clear(); dataListViewModel1.ScalarCollection.Clear(); dataListViewModel1.ComplexObjectCollection.Clear(); dataListViewModel.ComplexObjectCollection.Clear(); var carRecordset = DataListItemModelFactory.CreateRecordSetItemModel("Car", "A recordset of information about a car"); carRecordset.Children.Add(DataListItemModelFactory.CreateRecordSetFieldItemModel("Make", "Make of vehicle", carRecordset)); carRecordset.Children.Add(DataListItemModelFactory.CreateRecordSetFieldItemModel("Model", "Model of vehicle", carRecordset)); carRecordset.Input = true; carRecordset.Output = true; dataListViewModel.Add(carRecordset); dataListViewModel1.Add(carRecordset); dataListViewModel.Add(DataListItemModelFactory.CreateScalarItemModel("Country", "name of Country", enDev2ColumnArgumentDirection.Both)); //---------------Assert Precondition---------------- Assert.IsNotNull(dataListViewModel); Assert.IsNotNull(dataListViewModel1); //---------------Execute Test ---------------------- var equals = dataListViewModel.Equals(dataListViewModel1); //---------------Test Result ----------------------- Assert.IsFalse(equals); }
public void NewDataListViewModel_Object_IsEqual() { //---------------Set up test pack------------------- var mockResourceModel = Dev2MockFactory.SetupResourceModelMock(); var dataListViewModel = new DataListViewModel(new Mock <IEventAggregator>().Object); var dataListViewModel1 = new DataListViewModel(new Mock <IEventAggregator>().Object); dataListViewModel.InitializeDataListViewModel(mockResourceModel.Object); dataListViewModel1.InitializeDataListViewModel(mockResourceModel.Object); dataListViewModel.RecsetCollection.Clear(); dataListViewModel.ScalarCollection.Clear(); dataListViewModel1.RecsetCollection.Clear(); dataListViewModel1.ScalarCollection.Clear(); dataListViewModel1.ComplexObjectCollection.Clear(); dataListViewModel.ComplexObjectCollection.Clear(); //---------------Assert Precondition---------------- Assert.IsNotNull(dataListViewModel); Assert.IsNotNull(dataListViewModel1); //---------------Execute Test ---------------------- var equals = dataListViewModel.Equals(dataListViewModel1); //---------------Test Result ----------------------- Assert.IsTrue(equals); }
public void UpdateActiveDataList_Expected_NewActiveDataList() { Mock <IDataListViewModel> mockdataListViewModel = Dev2MockFactory.SetupDataListViewModel(); DataListSingleton.SetDataList(mockdataListViewModel.Object); Mock <IDataListViewModel> mock_newDataListViewModel = new Mock <IDataListViewModel>(); mock_newDataListViewModel.Setup(dataList => dataList.Resource).Returns(Dev2MockFactory.SetupResourceModelMock().Object); DataListSingleton.SetDataList(mock_newDataListViewModel.Object); Assert.AreNotEqual(DataListSingleton.ActiveDataList, mockdataListViewModel); }
public void DeploySummaryPredicateNew_EnvironmentContainsResource_Expected_False() { Mock <IContextualResourceModel> resourceModel = Dev2MockFactory.SetupResourceModelMock(Studio.Core.AppResources.Enums.ResourceType.WorkflowService); ExplorerItemModel navigationItemViewModel = new ExplorerItemModel(); IEnvironmentModel environmentModel = Dev2MockFactory.SetupEnvironmentModel(resourceModel, new List <IResourceModel>()).Object; bool actual = DeployStatsCalculator.DeploySummaryPredicateNew(navigationItemViewModel, environmentModel); Assert.IsFalse(actual); }
public void DeploySummaryPredicateNew_NullResourcesOnEnvironmentModel_Expected_False() { Dev2MockFactory.SetupResourceModelMock(Studio.Core.AppResources.Enums.ResourceType.WorkflowService); ExplorerItemModel navigationItemViewModel = new ExplorerItemModel(); Mock <IEnvironmentModel> mockEnvironmentModel = Dev2MockFactory.SetupEnvironmentModel(); mockEnvironmentModel.Setup(e => e.ResourceRepository).Returns <object>(null); IEnvironmentModel environmentModel = mockEnvironmentModel.Object; bool actual = DeployStatsCalculator.DeploySummaryPredicateNew(navigationItemViewModel, environmentModel); Assert.IsFalse(actual); }
public void DeploySummaryPredicateExisting_EnvironmentDoesntContainResource_Expected_False() { Mock <IContextualResourceModel> mockResourceModel = CreateMockResourceModel(); IEnvironmentModel environmentModel; IExplorerItemModel resourceVm; IExplorerItemModel rootItem; StudioResourceRepository studioResourceRepository = CreateModels(false, mockResourceModel, out environmentModel, out resourceVm, out rootItem); Mock <IContextualResourceModel> resourceModel = Dev2MockFactory.SetupResourceModelMock(Studio.Core.AppResources.Enums.ResourceType.WorkflowService, Guid.NewGuid()); environmentModel = Dev2MockFactory.SetupEnvironmentModel(resourceModel, new List <IResourceModel>(), new List <IResourceModel>()).Object; var navigationViewModel = CreateDeployNavigationViewModel(environmentModel, studioResourceRepository); resourceVm.IsChecked = true; bool actual = DeployStatsCalculator.DeploySummaryPredicateExisting(null, navigationViewModel); Assert.IsFalse(actual); }