Esempio n. 1
0
        private static void CreateTestSolution()
        {
            // First we create a basic solution with some sample items
            SolutionRepository SR = new SolutionRepository();

            //string TempRepositoryFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\SRTestTemp");
            if (Directory.Exists(TempRepositoryFolder))
            {
                Directory.Delete(TempRepositoryFolder, true);
            }

            // Define the items types we want in our Repository
            SR.AddItemInfo <MyRepositoryItem>("*.Ginger.MyRepositoryItem.xml", @"~\MyRepositoryItems", true, "My Repository Item", PropertyNameForFileName: nameof(MyRepositoryItem.Name));


            SR.CreateRepository(TempRepositoryFolder);
            SR.Open(TempRepositoryFolder);

            MyRepositoryItem A1 = new MyRepositoryItem("A1");

            SR.AddRepositoryItem(A1);

            MyRepositoryItem A2 = new MyRepositoryItem("A2");

            SR.AddRepositoryItem(A2);

            MyRepositoryItem A3 = new MyRepositoryItem("A3");

            SR.AddRepositoryItem(A3);


            RepositoryFolder <MyRepositoryItem> MyRepoRF   = SR.GetRepositoryItemRootFolder <MyRepositoryItem>();
            RepositoryFolder <MyRepositoryItem> SubFolder1 = (RepositoryFolder <MyRepositoryItem>)MyRepoRF.AddSubFolder("SubFolder1");

            MyRepoRF.AddSubFolder("EmptySubFolder");

            MyRepositoryItem A4 = new MyRepositoryItem("A4");

            SubFolder1.AddRepositoryItem(A4);

            // Folder to delete later
            MyRepoRF.AddSubFolder("SubFolderForDelete");

            // Create folders tree
            RepositoryFolder <MyRepositoryItem> SF1 = (RepositoryFolder <MyRepositoryItem>)MyRepoRF.AddSubFolder("SF1");
            RepositoryFolder <MyRepositoryItem> SF2 = (RepositoryFolder <MyRepositoryItem>)SF1.AddSubFolder("SF1_SF2");
            RepositoryFolder <MyRepositoryItem> SF3 = (RepositoryFolder <MyRepositoryItem>)SF2.AddSubFolder("SF1_SF2_SF3");
            MyRepositoryItem BF5 = new MyRepositoryItem("A5");

            SubFolder1.AddRepositoryItem(BF5);

            MyRepositoryItem BF6 = new MyRepositoryItem("A6");

            SF3.AddRepositoryItem(BF6);

            //TODO: add more sample items for testing
            SR.Close();
        }
Esempio n. 2
0
        public void AddNewMyRepositoryItemAndVerifyFileSaved()
        {
            //Arrange
            string           MRIName = "MRI Save 1";
            MyRepositoryItem MRI1    = new MyRepositoryItem(MRIName);

            //Act
            mSolutionRepository.AddRepositoryItem(MRI1);
            MyRepositoryItem MRI2 = (MyRepositoryItem)mRepositorySerializer.DeserializeFromFile(MRI1.FilePath);

            //Assert
            Assert.AreEqual(MRI1.Guid, MRI2.Guid);
            Assert.AreEqual(MRIName, MRI2.Name);
        }
Esempio n. 3
0
        public void TestBusinessFlowVariableSyncWithRepo()
        {
            string variableName = "BFV1";
            string initialValue = "123";
            string updatedValue = "abc123";

            mBF = new BusinessFlow()
            {
                Name = "TestBFVarSync", Active = true
            };

            VariableString V1 = new VariableString()
            {
                Name = variableName, InitialStringValue = initialValue
            };

            mBF.AddVariable(V1);

            // add business flow to the solution repository
            mSolutionRepository.AddRepositoryItem(mBF);

            // prepare to add the variable to the shared repository
            UploadItemSelection uploadItemSelection = new UploadItemSelection()
            {
                UsageItem = V1, ItemUploadType = UploadItemSelection.eItemUploadType.New
            };

            (new SharedRepositoryOperations()).UploadItemToRepository(new Context()
            {
                BusinessFlow = mBF
            }, uploadItemSelection);

            // find the newly added variable from the shared repo
            VariableBase   sharedVariableBase = (from x in mSolutionRepository.GetAllRepositoryItems <VariableBase>() where x.Name == variableName select x).SingleOrDefault();
            VariableString sharedV1           = (VariableString)sharedVariableBase;

            //update the new value in the shared repo variable
            sharedV1.InitialStringValue = updatedValue;

            //sync the updated instance with the business flow instance
            sharedV1.UpdateInstance(V1, "All", mBF);

            // get the updated value from the business flow
            VariableString V2 = (VariableString)mBF.Variables[0];

            //Assert
            Assert.AreEqual(1, mBF.Variables.Count);
            Assert.AreNotSame(V1, V2);
            Assert.AreEqual(updatedValue, V2.InitialStringValue);
        }
Esempio n. 4
0
        public void SingleBFActionConversionToNewActivityTest()
        {
            GetActivityWithActGenElementActions();

            // add business flow to the solution repository
            mSolutionRepository.AddRepositoryItem(mBF);

            ExecuteActionConversion(true, true, string.Empty);

            string targetType    = ((IObsoleteAction)mBF.Activities[0].Acts[0]).TargetAction().ToString();
            string convertedType = ((GingerCore.Actions.Act)mBF.Activities[1].Acts[0]).ActClass;

            string targetLocateType    = ((GingerCore.Actions.Act)mBF.Activities[0].Acts[0]).LocateBy.ToString();
            string convertedLocateType = ((GingerCore.Actions.Common.ActUIElement)mBF.Activities[1].Acts[0]).ElementLocateBy.ToString();

            string targetLocateValue    = ((GingerCore.Actions.Act)mBF.Activities[0].Acts[0]).LocateValue.ToString();
            string convertedLocateValue = ((GingerCore.Actions.Common.ActUIElement)mBF.Activities[1].Acts[0]).ElementLocateValue.ToString();

            ////Assert
            Assert.AreEqual(mBF.Activities.Count(), 2);
            Assert.AreEqual(targetType, convertedType);
            Assert.AreEqual(targetLocateType, convertedLocateType);
            Assert.AreEqual(targetLocateValue, convertedLocateValue);
        }
        private static void CreateTestSolution()
        {
            // First we create a basic solution with some sample items
            SolutionRepository SR = new SolutionRepository();
            string             TempRepositoryFolder = TestResources.getGingerUnitTesterTempFolder(@"Solutions\SRTestTemp");

            if (Directory.Exists(TempRepositoryFolder))
            {
                Directory.Delete(TempRepositoryFolder, true);
            }


            SR = Ginger.App.CreateGingerSolutionRepository();
            SR.Open(TempRepositoryFolder);

            ProjEnvironment E1 = new ProjEnvironment()
            {
                Name = "E1"
            };

            SR.AddRepositoryItem(E1);



            //RepositoryFolder<MyRepositoryItem> BFRF = SR.GetRepositoryItemRootFolder<MyRepositoryItem>();
            //RepositoryFolder<MyRepositoryItem> SubFolder1 = (RepositoryFolder<MyRepositoryItem>)BFRF.AddSubFolder("SubFolder1");

            //BFRF.AddSubFolder("EmptySubFolder");

            //MyRepositoryItem BF4 = new MyRepositoryItem("A4");
            //SubFolder1.AddRepositoryItem(BF4);

            //// Folder to delete later
            //BFRF.AddSubFolder("SubFolderForDelete");

            //// Create folders tree
            //RepositoryFolder<MyRepositoryItem> SF1 = (RepositoryFolder<MyRepositoryItem>)BFRF.AddSubFolder("SF1");
            //RepositoryFolder<MyRepositoryItem> SF2 = (RepositoryFolder<MyRepositoryItem>)SF1.AddSubFolder("SF1_SF2");
            //RepositoryFolder<MyRepositoryItem> SF3 = (RepositoryFolder<MyRepositoryItem>)SF2.AddSubFolder("SF1_SF2_SF3");
            //MyRepositoryItem BF5 = new MyRepositoryItem("A5");
            //SubFolder1.AddRepositoryItem(BF5);

            //MyRepositoryItem BF6 = new MyRepositoryItem("A6");
            //SF3.AddRepositoryItem(BF6);

            //TODO: add more sample items for testing
            SR.Close();
        }
Esempio n. 6
0
        private static void CreateTestSolution()
        {
            // First we create a basic solution with some sample items
            SolutionRepository SR = new SolutionRepository();
            string             TempRepositoryFolder = TestResources.GetTestTempFolder(@"Solutions\" + solutionName);

            if (Directory.Exists(TempRepositoryFolder))
            {
                Directory.Delete(TempRepositoryFolder, true);
            }

            SR = GingerSolutionRepository.CreateGingerSolutionRepository();
            SR.Open(TempRepositoryFolder);

            ProjEnvironment E1 = new ProjEnvironment()
            {
                Name = "E1"
            };

            SR.AddRepositoryItem(E1);

            SR.Close();
        }
        public void EnvRenameshouldKeepOriginalFileName()
        {
            //Arrange
            ProjEnvironment env1 = new ProjEnvironment()
            {
                Name = "EV1"
            };

            mSolutionRepository.AddRepositoryItem(env1);
            string filePath = env1.FilePath;

            //Act
            env1.Name = "EV1 A";
            //env1.Save();


            //Assert
            Assert.AreEqual(filePath, env1.FilePath);
        }
Esempio n. 8
0
        private void CreateSolutionItems()
        {
            //Business Flows
            BusinessFlow BF1 = new BusinessFlow("BF1");

            mSolutionRepository.AddRepositoryItem(BF1);


            BusinessFlow BF2 = new BusinessFlow("BF2");

            mSolutionRepository.AddRepositoryItem(BF2);

            BusinessFlow BF3 = new BusinessFlow("BF3");

            mSolutionRepository.AddRepositoryItem(BF3);

            RepositoryFolder <BusinessFlow> BFRF       = mSolutionRepository.GetRepositoryItemRootFolder <BusinessFlow>();
            RepositoryFolder <BusinessFlow> SubFolder1 = (RepositoryFolder <BusinessFlow>)BFRF.AddSubFolder("SubFolder1");

            BusinessFlow BF4 = new BusinessFlow("BF4");

            SubFolder1.AddRepositoryItem(BF4);

            // Folder to delete later
            BFRF.AddSubFolder("SubFolderForDelete");

            //Environments
            ProjEnvironment env1 = new ProjEnvironment();

            env1.Name = "Env1";
            mSolutionRepository.AddRepositoryItem(env1);

            ProjEnvironment env2 = new ProjEnvironment();

            env2.Name = "Env2";
            mSolutionRepository.AddRepositoryItem(env2);
            //TODO: add more sample items for testing
        }
Esempio n. 9
0
        public void ApplicationAPIModelVerifySavedFile()
        {
            // Arrange
            ApplicationAPIModel AAMS1 = new ApplicationAPIModel();

            //AAMS1.GroupName = "Group1";
            AAMS1.Name = "Group1_Operation1";
            SR.AddRepositoryItem(AAMS1);

            //Act
            ObservableList <ApplicationAPIModel> AAMBList = SR.GetAllRepositoryItems <ApplicationAPIModel>();
            ApplicationAPIModel AAMS2 = (ApplicationAPIModel)(from x in AAMBList where x.Guid == AAMS1.Guid select x).FirstOrDefault();

            NewRepositorySerializer RS = new NewRepositorySerializer();
            ApplicationAPIModel     ApplicationAPIModelFromDisk = (ApplicationAPIModel)RS.DeserializeFromFile(AAMS1.FilePath);

            //Assert
            Assert.IsTrue(AAMS2 != null, "New API Model found in AllItems");
            Assert.AreEqual(AAMS1, AAMS2, "Same object is retrieved");

            Assert.AreEqual(AAMS1.Name, ApplicationAPIModelFromDisk.Name, "Name saved to file");
            Assert.AreEqual(AAMS1.Guid, ApplicationAPIModelFromDisk.Guid, "Guid saved to file");
            // TODO: can add more validation
        }
Esempio n. 10
0
        private static void CreateTestSolution()
        {
            // First we create a basic solution with some sample items
            SolutionRepository SR = new SolutionRepository();

            if (Directory.Exists(TempRepositoryFolder))
            {
                Directory.Delete(TempRepositoryFolder, true);
            }

            // Define the items types we want in our Repository
            SR.AddItemInfo <MyRepositoryItem>(pattern: "*.Ginger.MyRepositoryItem.xml",   // Need to use for file name
                                              rootFolder: SolutionRepository.cSolutionRootFolderSign + "MyRepositoryItems",
                                              containRepositoryItems: true,
                                              displayName: "My Repository Item",
                                              PropertyNameForFileName: nameof(MyRepositoryItem.Name)
                                              );


            SR.CreateRepository(TempRepositoryFolder);
            SR.Open(TempRepositoryFolder);

            MyRepositoryItem A1 = new MyRepositoryItem("A1");

            SR.AddRepositoryItem(A1);

            MyRepositoryItem A2 = new MyRepositoryItem("A2");

            SR.AddRepositoryItem(A2);

            MyRepositoryItem A3 = new MyRepositoryItem("A3");

            SR.AddRepositoryItem(A3);


            RepositoryFolder <MyRepositoryItem> MyRepoRF   = SR.GetRepositoryItemRootFolder <MyRepositoryItem>();
            RepositoryFolder <MyRepositoryItem> SubFolder1 = (RepositoryFolder <MyRepositoryItem>)MyRepoRF.AddSubFolder("SubFolder1");

            MyRepoRF.AddSubFolder("EmptySubFolder");

            MyRepositoryItem A4 = new MyRepositoryItem("A4");

            SubFolder1.AddRepositoryItem(A4);

            // Folder to delete later
            MyRepoRF.AddSubFolder("SubFolderForDelete");

            // Create folders tree
            RepositoryFolder <MyRepositoryItem> SF1 = (RepositoryFolder <MyRepositoryItem>)MyRepoRF.AddSubFolder("SF1");
            RepositoryFolder <MyRepositoryItem> SF2 = (RepositoryFolder <MyRepositoryItem>)SF1.AddSubFolder("SF1_SF2");
            RepositoryFolder <MyRepositoryItem> SF3 = (RepositoryFolder <MyRepositoryItem>)SF2.AddSubFolder("SF1_SF2_SF3");
            MyRepositoryItem BF5 = new MyRepositoryItem("A5");

            SubFolder1.AddRepositoryItem(BF5);

            MyRepositoryItem BF6 = new MyRepositoryItem("A6");

            SF3.AddRepositoryItem(BF6);

            RepositoryFolder <MyRepositoryItem> bigFolder = (RepositoryFolder <MyRepositoryItem>)MyRepoRF.AddSubFolder("BigfolderWith100Items");


            // Add another 100 big item so it will take time loading and we can check multi thread access while load in progress
            for (int i = 0; i < 100; i++)
            {
                MyRepositoryItem bigItem = new MyRepositoryItem("Big Item #" + i);
                bigItem.BigStringHolderSlowSet = new string('a', 150000);
                bigFolder.AddRepositoryItem(bigItem);
            }

            //TODO: add more sample items for testing
            SR.Close();
        }
Esempio n. 11
0
        private static void CreateTestSolution()
        {
            // First we create a basic solution with some sample items
            SolutionRepository SR = new SolutionRepository();

            if (Directory.Exists(TempRepositoryFolder))
            {
                Directory.Delete(TempRepositoryFolder, true);
            }

            // Define the items types we want in our Repository
            //SR.AddItemInfo<MyRepositoryItem>("*.Ginger.MyRepositoryItem.xml", @"~\MyRepositoryItems", true, "My Repository Item", addToRootFolders: true, PropertyNameForFileName: nameof(MyRepositoryItem.Name));
            SR.AddItemInfo <MyRepositoryItem>(pattern: "*.Ginger.MyRepositoryItem.xml",   // Need to use for file name
                                              rootFolder: SolutionRepository.cSolutionRootFolderSign + "MyRepositoryItems",
                                              containRepositoryItems: true,
                                              displayName: "My Repository Item",
                                              PropertyNameForFileName: nameof(MyRepositoryItem.Name)
                                              );


            SR.CreateRepository(TempRepositoryFolder);
            SR.Open(TempRepositoryFolder);

            MyRepositoryItem A1 = new MyRepositoryItem("A1");

            SR.AddRepositoryItem(A1);

            MyRepositoryItem A2 = new MyRepositoryItem("A2");

            SR.AddRepositoryItem(A2);

            MyRepositoryItem A3 = new MyRepositoryItem("A3");

            SR.AddRepositoryItem(A3);


            RepositoryFolder <MyRepositoryItem> MyRepoRF   = SR.GetRepositoryItemRootFolder <MyRepositoryItem>();
            RepositoryFolder <MyRepositoryItem> SubFolder1 = (RepositoryFolder <MyRepositoryItem>)MyRepoRF.AddSubFolder("SubFolder1");

            MyRepoRF.AddSubFolder("EmptySubFolder");

            MyRepositoryItem A4 = new MyRepositoryItem("A4");

            SubFolder1.AddRepositoryItem(A4);

            // Folder to delete later
            MyRepoRF.AddSubFolder("SubFolderForDelete");

            // Create folders tree
            RepositoryFolder <MyRepositoryItem> SF1 = (RepositoryFolder <MyRepositoryItem>)MyRepoRF.AddSubFolder("SF1");
            RepositoryFolder <MyRepositoryItem> SF2 = (RepositoryFolder <MyRepositoryItem>)SF1.AddSubFolder("SF1_SF2");
            RepositoryFolder <MyRepositoryItem> SF3 = (RepositoryFolder <MyRepositoryItem>)SF2.AddSubFolder("SF1_SF2_SF3");
            MyRepositoryItem BF5 = new MyRepositoryItem("A5");

            SubFolder1.AddRepositoryItem(BF5);

            MyRepositoryItem BF6 = new MyRepositoryItem("A6");

            SF3.AddRepositoryItem(BF6);

            //TODO: add more sample items for testing
            SR.Close();
        }