public void JobsCountStrategyShouldHavePositiveCount()
        {
            var setting = new OrchestratorSettings()
            {
                AuthMode               = "Basic",
                TenancyName            = "Default",
                UsernameOrEmailAddress = "Test",
                Password               = "******",
                BaseUrl   = "Http://localhost",
                Strategy  = "JobsCount",
                JobsCount = -1,
            };

            Assert.False(setting.Validate());
        }
        public void SpecificStrategyShouldHaveAtLeastOneRobot()
        {
            var setting = new OrchestratorSettings()
            {
                AuthMode               = "Basic",
                TenancyName            = "Default",
                UsernameOrEmailAddress = "Test",
                Password               = "******",
                BaseUrl  = "Http://localhost",
                Strategy = "Specific",
                RobotIds = null,
            };

            Assert.False(setting.Validate());
        }
        public void UerTokenRequiredForCloudAuth()
        {
            var setting = new OrchestratorSettings()
            {
                AuthMode    = "Cloud",
                BaseUrl     = "Http://localhost",
                Strategy    = "JobsCount",
                JobsCount   = 1,
                ProcessKeys = new ProcessKey[] { new ProcessKey()
                                                 {
                                                     Key = Guid.NewGuid().ToString(), Process = "test"
                                                 } },
            };

            Assert.False(setting.Validate());
        }
        public void ShouldHaveAtLeastOneProcess()
        {
            var setting = new OrchestratorSettings()
            {
                AuthMode               = "Basic",
                TenancyName            = "Default",
                UsernameOrEmailAddress = "Test",
                Password               = "******",
                BaseUrl     = "Http://localhost",
                Strategy    = "JobsCount",
                JobsCount   = 1,
                ProcessKeys = null,
            };

            Assert.False(setting.Validate());
        }
        public void TwoStrategyAllowed()
        {
            var setting = new OrchestratorSettings()
            {
                AuthMode               = "Basic",
                TenancyName            = "Default",
                UsernameOrEmailAddress = "Test",
                Password               = "******",
                BaseUrl     = "Http://localhost",
                Strategy    = "invalid",
                ProcessKeys = new ProcessKey[] { new ProcessKey()
                                                 {
                                                     Key = Guid.NewGuid().ToString(), Process = "test"
                                                 } },
            };

            Assert.False(setting.Validate());
        }
        public void UrlShouldBeValid()
        {
            var setting = new OrchestratorSettings()
            {
                AuthMode               = "Basic",
                TenancyName            = "Default",
                UsernameOrEmailAddress = "Test",
                Password               = "******",
                BaseUrl     = "invalid",
                Strategy    = "JobsCount",
                JobsCount   = 1,
                ProcessKeys = new ProcessKey[] { new ProcessKey()
                                                 {
                                                     Key = Guid.NewGuid().ToString(), Process = "test"
                                                 } },
            };

            Assert.False(setting.Validate());
        }
        public void ValidCloudAuth()
        {
            var setting = new OrchestratorSettings()
            {
                AuthMode     = "Cloud",
                RefreshToken = "randometoken",
                ServiceInstanceLogicalName = "test",
                AccountLogicalName         = "test",
                BaseUrl     = "Https://platform.uipath.com",
                Strategy    = "Specific",
                RobotIds    = new long[] { 1, 2, 3 },
                ProcessKeys = new ProcessKey[] { new ProcessKey()
                                                 {
                                                     Key = Guid.NewGuid().ToString(), Process = "test"
                                                 } },
            };

            Assert.True(setting.Validate());
        }
        public void ProcessKeyShouldBeGuid()
        {
            var setting = new OrchestratorSettings()
            {
                AuthMode               = "Basic",
                TenancyName            = "Default",
                UsernameOrEmailAddress = "Test",
                Password               = "******",
                BaseUrl     = "Http://localhost",
                Strategy    = "JobsCount",
                JobsCount   = 1,
                ProcessKeys = new ProcessKey[] { new ProcessKey()
                                                 {
                                                     Key = "1234", Process = "test"
                                                 } },
            };

            Assert.False(setting.Validate());
        }