Inheritance: ActivityDesignerViewModel
 public void SequenceDesignerViewModel_Constructor_SetSmallViewItem_AlwaysReturnsNull()
 {
     //------------Setup for test--------------------------
     var sequenceActivity = new DsfSequenceActivity();
     var modelItem = ModelItemUtils.CreateModelItem(sequenceActivity);
     //------------Execute Test---------------------------
     var sequenceDesignerViewModel = new SequenceDesignerViewModel(modelItem) { SmallViewItem = "test" };
     //------------Assert Results-------------------------
     Assert.IsNull(sequenceDesignerViewModel.SmallViewItem, "This item should always be null");
 }
 public void SequenceDesignerViewModel_Constructor_Constructed_HasHelpLargeViewToogle()
 {
     //------------Setup for test--------------------------
     var modelItem = CreateModelItem();
     //------------Execute Test---------------------------
     var sequenceDesignerViewModel = new SequenceDesignerViewModel(modelItem);
     //------------Assert Results-------------------------
     Assert.IsNotNull(sequenceDesignerViewModel);
     Assert.IsTrue(sequenceDesignerViewModel.HasLargeView);
     Assert.AreEqual(1, sequenceDesignerViewModel.TitleBarToggles.Count);
     StringAssert.Contains(sequenceDesignerViewModel.TitleBarToggles[0].ExpandToolTip, "Help");
 }
 public void SequenceDesignerViewModel_Constructor_Constructed_IsInstanceOfActivityDesignerViewModel()
 {
     //------------Setup for test--------------------------
     var sequenceActivity = new DsfSequenceActivity { DisplayName = "Created Sequence" };
     var modelItem = ModelItemUtils.CreateModelItem(sequenceActivity);
     //------------Execute Test---------------------------
     var sequenceDesignerViewModel = new SequenceDesignerViewModel(modelItem);
     //------------Assert Results-------------------------
     Assert.IsNotNull(sequenceDesignerViewModel);
     Assert.IsInstanceOfType(sequenceDesignerViewModel, typeof(ActivityDesignerViewModel));
     Assert.AreEqual("Created Sequence", sequenceDesignerViewModel.ModelItem.GetProperty("DisplayName"));
 }
 public void SequenceDesignerViewModel_ActivityNames_WhenNewSequence_HasEmptyList()
 {
     //------------Setup for test--------------------------
     var dsfSequenceActivity = new DsfSequenceActivity();
     var sequenceDesignerViewModel = new SequenceDesignerViewModel(CreateModelItem(dsfSequenceActivity));
     //------------Execute Test---------------------------
     var activityNames = sequenceDesignerViewModel.ActivityNames;
     //------------Assert Results-------------------------
     Assert.AreEqual(0, activityNames.Count);
 }
 public void SequenceDesignerViewModel_SetModelItemForServiceTypes_DataHaveDataContextNotResourceModel_NothingAddedToDataObject()
 {
     //------------Setup for test--------------------------
     var dsfSequenceActivity = new DsfSequenceActivity();
     var dsfMultiAssignActivity = new DsfMultiAssignActivity();
     dsfSequenceActivity.Activities.Add(dsfMultiAssignActivity);
     var sequenceDesignerViewModel = new SequenceDesignerViewModel(CreateModelItem(dsfSequenceActivity));
     var dataObject = new DataObject(GlobalConstants.ExplorerItemModelFormat, new TestDataWithContext());
     //------------Execute Test---------------------------
     sequenceDesignerViewModel.SetModelItemForServiceTypes(dataObject);
     //------------Assert Results-------------------------
     bool dataPresent = dataObject.GetDataPresent(DragDropHelper.ModelItemDataFormat);
     Assert.IsFalse(dataPresent);
 }
        public void SequenceDesignerViewModel_SetModelItemForServiceTypes_DataHaveDataContextResourceModel_NothingAddedToDataObject()
        {
            //------------Setup for test--------------------------
            var dsfSequenceActivity = new DsfSequenceActivity();
            var dsfMultiAssignActivity = new DsfMultiAssignActivity();
            dsfSequenceActivity.Activities.Add(dsfMultiAssignActivity);
            SetupEnvironmentRepo(Guid.Empty);
            var sequenceDesignerViewModel = new SequenceDesignerViewModel(CreateModelItem(dsfSequenceActivity));
            var dataObject = new DataObject(GlobalConstants.ExplorerItemModelFormat, new ExplorerItemModel { DisplayName = "MyDBService", ResourceType = ResourceType.DbService, EnvironmentId = Guid.Empty });
            //------------Execute Test---------------------------
            bool added = sequenceDesignerViewModel.SetModelItemForServiceTypes(dataObject);
            //------------Assert Results-------------------------
            Assert.IsTrue(added);
            Assert.AreEqual(2, dsfSequenceActivity.Activities.Count);

        }
 public void SequenceDesignerViewModel_SetModelItemForServiceTypes_DataObjectNull_NothingAddedToDataObject()
 {
     //------------Setup for test--------------------------
     var dsfSequenceActivity = new DsfSequenceActivity();
     var dsfMultiAssignActivity = new DsfMultiAssignActivity();
     dsfSequenceActivity.Activities.Add(dsfMultiAssignActivity);
     var sequenceDesignerViewModel = new SequenceDesignerViewModel(CreateModelItem(dsfSequenceActivity));
     //------------Execute Test---------------------------
     var modelItemForServiceTypes = sequenceDesignerViewModel.SetModelItemForServiceTypes(null);
     //------------Assert Results-------------------------
     Assert.IsFalse(modelItemForServiceTypes);
 }
 public void SequenceDesignerViewModel_SetModelItemForServiceTypes_Data_NothingAddedToDataObject()
 {
     //------------Setup for test--------------------------
     var dsfSequenceActivity = new DsfSequenceActivity();
     var dsfMultiAssignActivity = new DsfMultiAssignActivity();
     dsfSequenceActivity.Activities.Add(dsfMultiAssignActivity);
     var sequenceDesignerViewModel = new SequenceDesignerViewModel(CreateModelItem(dsfSequenceActivity));
     var dataObject = new DataObject("Some Wrong Format", new object());
     //------------Execute Test---------------------------
     sequenceDesignerViewModel.SetModelItemForServiceTypes(dataObject);
     //------------Assert Results-------------------------
     bool dataPresent = dataObject.GetDataPresent(DragDropHelper.ModelItemDataFormat);
     Assert.IsFalse(dataPresent);
 }
 public void SequenceDesignerViewModel_DoDrop_WhenFormatDoesNotContainModelItemFormat_ActivityNotAdded()
 {
     //------------Setup for test--------------------------
     var dsfSequenceActivity = new DsfSequenceActivity();
     var dsfMultiAssignActivity = new DsfMultiAssignActivity();
     dsfSequenceActivity.Activities.Add(dsfMultiAssignActivity);
     var dsfFindRecordsMultipleCriteriaActivity = new DsfFindRecordsMultipleCriteriaActivity();
     dsfSequenceActivity.Activities.Add(dsfFindRecordsMultipleCriteriaActivity);
     var sequenceDesignerViewModel = new SequenceDesignerViewModel(CreateModelItem(dsfSequenceActivity));
     var dataObjectMock = new Mock<IDataObject>();
     dataObjectMock.Setup(o => o.GetFormats()).Returns(new[] { "Something Else" });
     dataObjectMock.Setup(o => o.GetData("Something Else")).Returns(ModelItemUtils.CreateModelItem(new DsfGatherSystemInformationActivity()));
     //------------Execute Test---------------------------
     bool doDrop = sequenceDesignerViewModel.DoDrop(dataObjectMock.Object);
     //------------Assert Results-------------------------
     Assert.IsFalse(doDrop);
     Assert.AreEqual(2, dsfSequenceActivity.Activities.Count);
 }
 public void SequenceDesignerViewModel_DoDrop_WhenModelItemsFormatHasSingleItem_ActivitiesAdded()
 {
     //------------Setup for test--------------------------
     var dsfSequenceActivity = new DsfSequenceActivity();
     var dsfMultiAssignActivity = new DsfMultiAssignActivity();
     dsfSequenceActivity.Activities.Add(dsfMultiAssignActivity);
     var dsfFindRecordsMultipleCriteriaActivity = new DsfFindRecordsMultipleCriteriaActivity();
     dsfSequenceActivity.Activities.Add(dsfFindRecordsMultipleCriteriaActivity);
     var sequenceDesignerViewModel = new SequenceDesignerViewModel(CreateModelItem(dsfSequenceActivity));
     var dataObjectMock = new Mock<IDataObject>();
     dataObjectMock.Setup(o => o.GetFormats()).Returns(new[] { "ModelItemsFormat" });
     dataObjectMock.Setup(o => o.GetData("ModelItemsFormat")).Returns(new List<ModelItem> { ModelItemUtils.CreateModelItem(new DsfGatherSystemInformationActivity()) });
     //------------Execute Test---------------------------
     bool doDrop = sequenceDesignerViewModel.DoDrop(dataObjectMock.Object);
     //------------Assert Results-------------------------
     Assert.IsTrue(doDrop);
     Assert.AreEqual(3, dsfSequenceActivity.Activities.Count);
 }
 public void SequenceDesignerViewModel_DoDrop_WhenNoFormats_ActivityNotAdded()
 {
     //------------Setup for test--------------------------
     var dsfSequenceActivity = new DsfSequenceActivity();
     var dsfMultiAssignActivity = new DsfMultiAssignActivity();
     dsfSequenceActivity.Activities.Add(dsfMultiAssignActivity);
     var dsfFindRecordsMultipleCriteriaActivity = new DsfFindRecordsMultipleCriteriaActivity();
     dsfSequenceActivity.Activities.Add(dsfFindRecordsMultipleCriteriaActivity);
     var sequenceDesignerViewModel = new SequenceDesignerViewModel(CreateModelItem(dsfSequenceActivity));
     var dataObjectMock = new Mock<IDataObject>();
     dataObjectMock.Setup(o => o.GetFormats()).Returns(new string[] { });
     //------------Execute Test---------------------------
     bool doDrop = sequenceDesignerViewModel.DoDrop(dataObjectMock.Object);
     //------------Assert Results-------------------------
     Assert.IsFalse(doDrop);
     Assert.AreEqual(2, dsfSequenceActivity.Activities.Count);
 }
 public void SequenceDesignerViewModel_SetSmallViewItem_WhenModelItemDsfDbServiceActivity_ActivityNotAdded()
 {
     //------------Setup for test--------------------------
     var dsfSequenceActivity = new DsfSequenceActivity();
     var dsfMultiAssignActivity = new DsfMultiAssignActivity();
     dsfSequenceActivity.Activities.Add(dsfMultiAssignActivity);
     var dsfFindRecordsMultipleCriteriaActivity = new DsfFindRecordsMultipleCriteriaActivity();
     dsfSequenceActivity.Activities.Add(dsfFindRecordsMultipleCriteriaActivity);
     var sequenceDesignerViewModel = new SequenceDesignerViewModel(CreateModelItem(dsfSequenceActivity));
     ModelItem modelItem = ModelItemUtils.CreateModelItem(new DsfDatabaseActivity());
     //------------Execute Test---------------------------
     sequenceDesignerViewModel.SmallViewItem = modelItem;
     //------------Assert Results-------------------------
     Assert.AreEqual(2, dsfSequenceActivity.Activities.Count);
 }
 public void SequenceDesignerViewModel_SetSmallViewItem_WhenValidModelItem_ActivityAdded()
 {
     //------------Setup for test--------------------------
     var dsfSequenceActivity = new DsfSequenceActivity();
     var dsfMultiAssignActivity = new DsfMultiAssignActivity();
     dsfSequenceActivity.Activities.Add(dsfMultiAssignActivity);
     var dsfFindRecordsMultipleCriteriaActivity = new DsfFindRecordsMultipleCriteriaActivity();
     dsfSequenceActivity.Activities.Add(dsfFindRecordsMultipleCriteriaActivity);
     var sequenceDesignerViewModel = new SequenceDesignerViewModel(CreateModelItem(dsfSequenceActivity));
     ModelItem modelItem = ModelItemUtils.CreateModelItem(new DsfGatherSystemInformationActivity());
     //------------Execute Test---------------------------
     sequenceDesignerViewModel.SmallViewItem = modelItem;
     //------------Assert Results-------------------------
     Assert.AreEqual(3, dsfSequenceActivity.Activities.Count);
 }
        public void SequenceDesignerViewModel_ActivityNames_WhenMoreThan4_Has4NamesLastItemEllipsis()
        {
            //------------Setup for test--------------------------
            var dsfSequenceActivity = new DsfSequenceActivity();
            var dsfMultiAssignActivity = new DsfMultiAssignActivity();
            dsfSequenceActivity.Activities.Add(dsfMultiAssignActivity);
            var dsfFindRecordsMultipleCriteriaActivity = new DsfFindRecordsMultipleCriteriaActivity();
            dsfSequenceActivity.Activities.Add(dsfFindRecordsMultipleCriteriaActivity);
            var dsfGatherSystemInformationActivity = new DsfGatherSystemInformationActivity();
            dsfSequenceActivity.Activities.Add(dsfGatherSystemInformationActivity);
            var dsfBaseConvertActivity = new DsfBaseConvertActivity();
            dsfSequenceActivity.Activities.Add(dsfBaseConvertActivity);
            var dsfCaseConvertActivity = new DsfCaseConvertActivity();
            dsfSequenceActivity.Activities.Add(dsfCaseConvertActivity);
            var dsfCalculateActivity = new DsfCalculateActivity();
            dsfSequenceActivity.Activities.Add(dsfCalculateActivity);
            var sequenceDesignerViewModel = new SequenceDesignerViewModel(CreateModelItem(dsfSequenceActivity));
            //------------Execute Test---------------------------
            var activityNames = sequenceDesignerViewModel.ActivityNames;
            //------------Assert Results-------------------------
            Assert.AreEqual(5, activityNames.Count);
            Assert.AreEqual(dsfMultiAssignActivity.DisplayName, activityNames[0]);
            Assert.AreEqual(dsfFindRecordsMultipleCriteriaActivity.DisplayName, activityNames[1]);
            Assert.AreEqual(dsfGatherSystemInformationActivity.DisplayName, activityNames[2]);
            Assert.AreEqual(dsfBaseConvertActivity.DisplayName, activityNames[3]);
            Assert.AreEqual("...", activityNames[4]);

            CollectionAssert.DoesNotContain(activityNames, dsfCaseConvertActivity.DisplayName);
            CollectionAssert.DoesNotContain(activityNames, dsfCalculateActivity.DisplayName);
        }
 public void SequenceDesignerViewModel_ActivityNames_When4_HasAllNames()
 {
     //------------Setup for test--------------------------
     var dsfSequenceActivity = new DsfSequenceActivity();
     var dsfMultiAssignActivity = new DsfMultiAssignActivity();
     dsfSequenceActivity.Activities.Add(dsfMultiAssignActivity);
     var dsfFindRecordsMultipleCriteriaActivity = new DsfFindRecordsMultipleCriteriaActivity();
     dsfSequenceActivity.Activities.Add(dsfFindRecordsMultipleCriteriaActivity);
     var dsfGatherSystemInformationActivity = new DsfGatherSystemInformationActivity();
     dsfSequenceActivity.Activities.Add(dsfGatherSystemInformationActivity);
     var dsfBaseConvertActivity = new DsfBaseConvertActivity();
     dsfSequenceActivity.Activities.Add(dsfBaseConvertActivity);
     var sequenceDesignerViewModel = new SequenceDesignerViewModel(CreateModelItem(dsfSequenceActivity));
     //------------Execute Test---------------------------
     var activityNames = sequenceDesignerViewModel.ActivityNames;
     //------------Assert Results-------------------------
     Assert.AreEqual(4, activityNames.Count);
     Assert.AreEqual(dsfMultiAssignActivity.DisplayName, activityNames[0]);
     Assert.AreEqual(dsfFindRecordsMultipleCriteriaActivity.DisplayName, activityNames[1]);
     Assert.AreEqual(dsfGatherSystemInformationActivity.DisplayName, activityNames[2]);
     Assert.AreEqual(dsfBaseConvertActivity.DisplayName, activityNames[3]);
 }