Exemplo n.º 1
0
        public void NoLoadedPackages()
        {
            // Mock Dynamo version
            var dynamoVersion = AssemblyHelper.GetDynamoVersion().ToString();

            //Gets package loader
            var packageLoader = CurrentDynamoModel.GetPackageManagerExtension()?.PackageLoader;

            Assert.IsNotNull(packageLoader);
            Assert.IsEmpty(packageLoader.LocalPackages);

            //Get packages data from null package loader
            var packagesData = Wpf.Utilities.CrashUtilities.PackagesToMakrdown(packageLoader);

            // Create a crash report to submit
            var crashReport = Wpf.Utilities.CrashUtilities.BuildMarkdownContent(dynamoVersion, packagesData);

            Assert.IsNotNullOrEmpty(crashReport);

            // Mock url for request
            string url = Wpf.Utilities.CrashUtilities.GithubNewIssueUrlFromCrashContent(crashReport);

            Assert.IsNotNullOrEmpty(url);

            // Get body content from request
            var query      = "body=";
            var startIndex = url.IndexOf(query) + query.Length;
            var body       = url.Substring(startIndex);
            var decoded    = Uri.UnescapeDataString(body);

            var expectedString = "No loaded packages were found.";

            // Verify request contains the packages information
            Assert.True(decoded.Contains(expectedString));
        }