Example #1
0
        private void Can_Call_List_Command_O365_Internal(string webSiteUrl)
        {
            var hasOnTraceEvents = false;

            var userName     = EnvironmentUtils.GetEnvironmentVariable(RegConsts.O365.UserName);
            var userPassword = EnvironmentUtils.GetEnvironmentVariable(RegConsts.O365.UserPassword);

            var command = new NuGetListCommand
            {
                Url = webSiteUrl,

                UserName     = userName,
                UserPassword = userPassword,

                SharePointVersion = "o365",

                PreRelease = true
            };

            command.OnTraceEvent += (s, e) =>
            {
                hasOnTraceEvents = true;
                Trace.WriteLine(e.Message);
            };

            command.Execute();

            Assert.IsTrue(command.Packages.Count() > 0);
            Assert.IsTrue(hasOnTraceEvents);
        }
Example #2
0
        protected virtual int HandleListCommand(string[] args, DefaultOptions options)
        {
            var op = options.List;

            ConfigureServices(op);

            if (!CmdParser.ParseArguments(args, op))
            {
                return(1);
            }

            var command = new NuGetListCommand
            {
                Url          = op.Url,
                UserName     = op.UserName,
                UserPassword = op.UserPassword
            };

            if (string.IsNullOrEmpty(op.SharePointVersion))
            {
                command.SharePointVersion = SharePointRuntimVersions.O365;
            }

            command.Execute();

            return(0);
        }
Example #3
0
        public void Can_Call_List_Command_OnPremise()
        {
            var hasOnTraceEvents = false;
            var webSiteUrl       = EnvironmentUtils.GetEnvironmentVariable(RegConsts.SP2013.RootWebUrl);

            var command = new NuGetListCommand
            {
                Url = webSiteUrl,

                SharePointApi     = "CSOM",
                SharePointEdition = "Standard",
                SharePointVersion = "SP2013",

                UserName     = SP2013UserName,
                UserPassword = SP2013UserPassword,

                PreRelease = true
            };

            command.OnTraceEvent += (s, e) =>
            {
                hasOnTraceEvents = true;
                Trace.WriteLine(e.Message);
            };

            command.Execute();

            Assert.IsTrue(command.Packages.Count() > 0);
            Assert.IsTrue(hasOnTraceEvents);
        }
Example #4
0
        internal IEnumerable <NuGetPackageViewModel> FetchInstalledNuGetPackages(SharePointConnection connection)
        {
            var result  = new List <NuGetPackageViewModel>();
            var command = new NuGetListCommand();

            command.Url = connection.Url;

            if (connection.AuthMode.Id == SharePointConnectionAuthMode.SharePointOnline.Id)
            {
                command.SharePointVersion = "o365";

                command.UserName     = connection.UserName;
                command.UserPassword = connection.UserPassword;
            }
            else if (connection.AuthMode.Id == SharePointConnectionAuthMode.WindowsAuthentication.Id)
            {
                command.SharePointVersion = "sp2013";

                if (!string.IsNullOrEmpty(connection.UserName) &&
                    !string.IsNullOrEmpty(connection.UserPassword))
                {
                    command.UserName     = connection.UserName;
                    command.UserPassword = connection.UserPassword;
                }
            }

            command.Execute();

            foreach (var p in command.Packages)
            {
                result.Add(new NuGetPackageViewModel(p));
            }

            return(result);
        }