Esempio n. 1
0
        public void GetStartedGuide_ValidateControlNames()
        {
            //Initialize the GuideManager to null to later we can verify that it was created correctly
            GuidesManager testGuide = null;

            string failMessageFile = string.Format("The guides JSON file: {0} couldn't be located or doesn't exits", GuidesManager.GuidesJsonFilePath);

            Assert.IsTrue(File.Exists(GuidesManager.GuidesJsonFilePath), failMessageFile);

            //Creates the Guides Manager passing the Dynamo Window and ViewModel and validates that no exception is thrown
            Assert.DoesNotThrow(() => testGuide = new GuidesManager(View, ViewModel));

            //Initializes variables and reads json properties
            Assert.DoesNotThrow(() => testGuide.Initialize());

            //Find the Get Started guide in the list
            var getStartedGuide = (from guide in testGuide.Guides
                                   where guide.Name.ToUpper().Equals("GET STARTED")
                                   select guide).FirstOrDefault();

            //Validate that the GetStarted guide exists
            Assert.IsNotNull(getStartedGuide, "Get Started guide doesn't exists in the guides json file");

            string elementNotFoundMessage = string.Empty;

            foreach (var step in getStartedGuide.GuideSteps)
            {
                //Validate that for each Step, the HostUIElementString element exists in the Dynamo VisualTree
                var childFound = Guide.FindChild(View, step.HostPopupInfo.HostUIElementString);
                elementNotFoundMessage = string.Format("The UIElement: {0} was not found in the DynamoView VisualTree", step.HostPopupInfo.HostUIElementString);
                Assert.IsNotNull(childFound, elementNotFoundMessage);
            }
        }