public static void ValidateConfig(this ICakeContext context, ValidateArgs args) { DependencyConfig.Setup(args, context).GetAwaiter().GetResult(); var cmd = DependencyConfig.Container.GetService <ValidateLibraryCommand>(); cmd.Execute().GetAwaiter().GetResult(); }
public string validate(string data = null) { ValidateArgs args = new ValidateArgs(); args.Data = data; _form.OnValidate?.Invoke(this, args); return(JsonConvert.SerializeObject(args.Errors)); }
public void Process_Aborted() { var validateArgs = new ValidateArgs(); var args = new ImportItemsArgs { FileStream = null }; validateArgs.Process(args); Assert.True(args.Aborted); }
public ValidateLibraryCommand(ValidateArgs args, ISecretsMananger secretsMananger, ILibraryManager libraryManager, VariableConverter jsonValidator, IFileSystem fileSystem, ILogger logger) { _args = args ?? throw new ArgumentNullException(nameof(args)); _secretsMananger = secretsMananger ?? throw new ArgumentNullException(nameof(secretsMananger)); _libraryManager = libraryManager ?? throw new ArgumentNullException(nameof(libraryManager)); _jsonValidator = jsonValidator ?? throw new ArgumentNullException(nameof(jsonValidator)); _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
private void Handle(ValidateArgs msg) { IncrementMessagesReceived(); var child = Context.Child("directoryCrawler"); if (child.Equals(ActorRefs.Nobody)) { child = Context.ActorOf <DirectoryCrawler>("directoryCrawler"); } child.Tell(new DirectoryToSearchMessage(msg.Folders, msg.Extension)); }
public string Execute(ValidateArgs args) { _console.WriteLine("Validating the Environment for Resgrid Operations"); _console.WriteLine("Please Wait..."); try { } catch (Exception ex) { } return(""); }
static void Main(string[] args) { var test = new Addor(); var test2 = new Addor(); // Console.WriteLine(test.add()); // Console.WriteLine( // Object.ReferenceEquals(test, test2) // ); // Console.WriteLine( // Object.ReferenceEquals(test.getInstance(), test2.getInstance()) // ); // Console.WriteLine(default(int)); // Addor1 tests var addor1Test2 = new Addor1(); var addor1Test3 = new Addor1(); // Proves singletong works... var finalTest = Object.ReferenceEquals(addor1Test2.getInstance(), addor1Test3.getInstance()); // Console.WriteLine(finalTest); // Addor1 type of checking... var valArgs = new ValidateArgs(); string[] args1 = new string[] { "--count", "name" }; var res = valArgs.Validate(args1); Console.WriteLine( res ); string[] args2 = new string[] { "--name" }; Console.WriteLine( valArgs.Validate(args2) ); Console.WriteLine("Hello World!"); }
public void RemoveWatch(string path) { ValidateArgs.NotNullOrEmpty(path, "path"); if (!String.IsNullOrEmpty(path)) { FileWatcherInfo watcherInfo; if (fileWatchers.TryGetValue(path, out watcherInfo)) { watcherInfo.Watcher.EnableRaisingEvents = false; fileWatchers.Remove(path); watcherInfo.Watcher.Changed -= OnChanged; watcherInfo.Watcher.Dispose(); watcherInfo.Watcher = null; } } }
public void AddWatch(string path) { ValidateArgs.NotNullOrEmpty(path, "path"); if (!String.IsNullOrEmpty(path)) { var directoryName = Path.GetDirectoryName(path); var fileName = Path.GetFileName(path); FileWatcherInfo watcherInfo; if (!fileWatchers.TryGetValue(path, out watcherInfo)) { watcherInfo = new FileWatcherInfo(new FileSystemWatcher(directoryName, fileName)); fileWatchers.Add(path, watcherInfo); watcherInfo.Watcher.Changed += OnChanged; watcherInfo.Watcher.EnableRaisingEvents = true; } } }
private void Handle(ValidateArgs msg) { if (String.IsNullOrEmpty(msg.Folders)) { Sender.Tell(new InvalidArgs("Folders argument is empty.")); } if (Directory.Exists(msg.Folders)) { var extension = msg.Extension; if (String.IsNullOrEmpty(extension)) { extension = "*.txt"; } Sender.Tell(new ValidateArgs(msg.Folders, extension)); } else { Sender.Tell(new StatusMessage(String.Format("Invalid Folder [{0}] [{1}]", msg.Folders, msg.Extension))); } }
private void Handle(ValidateArgs msg) { IncrementMessagesReceived(); if (String.IsNullOrEmpty(msg.Folders)) { Sender.Tell(new InvalidArgs("Folders argument is empty.")); } else if (Directory.Exists(msg.Folders)) { var extension = msg.Extension; if (String.IsNullOrEmpty(extension)) { extension = "*.txt"; } Sender.Tell(new ValidateArgs(msg.Folders, extension)); } else { Sender.Tell(new InvalidArgs(String.Format("Invalid Folder [{0}] [{1}]", msg.Folders, msg.Extension))); } Context.Stop(Self); }
public async Task VariablesAreSetCorrectly(string json, [Frozen] Mock <ISecretsMananger> mockSecret, [Frozen] Mock <ILibraryManager> mockLibrary, [Frozen] MockFileSystem mockFileSystem, [Frozen] ValidateArgs args, ValidateLibraryCommand sut) { mockFileSystem.AddFile(args.File, new MockFileData(json)); await sut.Execute().ConfigureAwait(false); mockSecret.Verify(m => m.ReplaceSecrets(It.Is <List <SecretVariable> >(l => l.Count == 1), args), Times.Once); mockLibrary.Verify(m => m.UpdateVars(It.Is <List <SecretVariable> >(l => l.Count == 1), It.IsAny <string>(), It.IsAny <IEnumerable <string> >(), It.IsAny <IEnumerable <string> >(), It.Is <bool>(b => !b)), Times.Once); }
void NodeActions_Validate(object Sender, ValidateArgs e) { if (e.Node == null) { return; } UserLightPropertyCollection pc = Security.CurrentUser.Properties; int iObjTypeId = -1; int iObjId = -1; if (HttpContext.Current.Items["ObjectTypeId"] != null) { iObjTypeId = (int)HttpContext.Current.Items["ObjectTypeId"]; } if (HttpContext.Current.Items["ObjectId"] != null) { iObjId = (int)HttpContext.Current.Items["ObjectId"]; } switch (e.CommandUid) { #region Reply case "Reply": if (e.Node.Type == "email" && e.Node.Attributes.ContainsKey("Incoming") && pc["IncForum_ReplyOutlook"] != "1" && pc["IncForum_ReplyEML"] != "1") { e.IsEnabled = true; e.IsVisible = true; } break; #endregion #region ReplyOutlook case "ReplyOutlook": if (e.Node.Type == "email" && e.Node.Attributes.ContainsKey("Incoming") && pc["IncForum_ReplyOutlook"] == "1") { e.IsEnabled = true; e.IsVisible = true; } break; #endregion #region ReplyEML case "ReplyEML": if (e.Node.Type == "email" && e.Node.Attributes.ContainsKey("Incoming") && pc["IncForum_ReplyEML"] != "1") { e.IsEnabled = true; e.IsVisible = true; } break; #endregion #region ReSend case "ReSend": if (iObjTypeId == (int)ObjectTypes.Issue) { if (e.Node.Type == "email") { if (e.Node.Attributes.ContainsKey("Incoming")) { IncidentBox incidentBox = IncidentBox.Load(Incident.GetIncidentBox(iObjId)); EMailRouterIncidentBoxBlock settings = IncidentBoxDocument.Load(incidentBox.IncidentBoxId).EMailRouterBlock; if (settings.AllowEMailRouting) { e.IsEnabled = true; e.IsVisible = true; } } } } break; #endregion #region ReSendOut case "ReSendOut": if (iObjTypeId == (int)ObjectTypes.Issue) { if (e.Node.Type == "email") { if (e.Node.Attributes.ContainsKey("Outgoing")) { e.IsEnabled = true; e.IsVisible = true; } } } break; #endregion #region Resolution case "Resolution": if (iObjTypeId == (int)ObjectTypes.Issue) { if (!e.Node.Attributes.ContainsKey("Resolution") && !e.Node.Attributes.ContainsKey("Question")) { e.IsEnabled = true; e.IsVisible = true; } } break; #endregion #region UnResolution case "UnResolution": if (iObjTypeId == (int)ObjectTypes.Issue) { if (e.Node.Attributes.ContainsKey("Resolution")) { e.IsEnabled = true; e.IsVisible = true; } } break; #endregion #region Workaround case "Workaround": if (iObjTypeId == (int)ObjectTypes.Issue) { if (!e.Node.Attributes.ContainsKey("Workaround") && !e.Node.Attributes.ContainsKey("Question")) { e.IsEnabled = true; e.IsVisible = true; } } break; #endregion #region UnWorkaround case "UnWorkaround": if (iObjTypeId == (int)ObjectTypes.Issue) { if (e.Node.Attributes.ContainsKey("Workaround")) { e.IsEnabled = true; e.IsVisible = true; } } break; #endregion #region OnTop case "OnTop": if (!e.Node.Attributes.ContainsKey(Node.ONTOP_ATTRIBUTE)) { e.IsEnabled = true; e.IsVisible = true; } break; #endregion #region UnOnTop case "UnOnTop": if (e.Node.Attributes.ContainsKey(Node.ONTOP_ATTRIBUTE)) { e.IsEnabled = true; e.IsVisible = true; } break; #endregion #region Delete case "Delete": if (iObjTypeId == (int)ObjectTypes.Issue) { bool CanUpdate = Incident.CanUpdate(iObjId); e.IsEnabled = CanUpdate; e.IsVisible = CanUpdate; e.IsBreak = true; } break; #endregion default: break; } }
void NodeActions_Validate(object Sender, ValidateArgs e) { if (e.Node == null) return; UserLightPropertyCollection pc = Security.CurrentUser.Properties; int iObjTypeId = -1; int iObjId = -1; if(HttpContext.Current.Items["ObjectTypeId"]!=null) iObjTypeId = (int)HttpContext.Current.Items["ObjectTypeId"]; if(HttpContext.Current.Items["ObjectId"]!=null) iObjId = (int)HttpContext.Current.Items["ObjectId"]; switch (e.CommandUid) { #region Reply case "Reply": if (e.Node.Type == "email" && e.Node.Attributes.ContainsKey("Incoming") && pc["IncForum_ReplyOutlook"] != "1" && pc["IncForum_ReplyEML"] != "1") { e.IsEnabled = true; e.IsVisible = true; } break; #endregion #region ReplyOutlook case "ReplyOutlook": if (e.Node.Type == "email" && e.Node.Attributes.ContainsKey("Incoming") && pc["IncForum_ReplyOutlook"] == "1") { e.IsEnabled = true; e.IsVisible = true; } break; #endregion #region ReplyEML case "ReplyEML": if (e.Node.Type == "email" && e.Node.Attributes.ContainsKey("Incoming") && pc["IncForum_ReplyEML"] != "1") { e.IsEnabled = true; e.IsVisible = true; } break; #endregion #region ReSend case "ReSend": if (iObjTypeId == (int)ObjectTypes.Issue) { if (e.Node.Type == "email") { if (e.Node.Attributes.ContainsKey("Incoming")) { IncidentBox incidentBox = IncidentBox.Load(Incident.GetIncidentBox(iObjId)); EMailRouterIncidentBoxBlock settings = IncidentBoxDocument.Load(incidentBox.IncidentBoxId).EMailRouterBlock; if (settings.AllowEMailRouting) { e.IsEnabled = true; e.IsVisible = true; } } } } break; #endregion #region ReSendOut case "ReSendOut": if (iObjTypeId == (int)ObjectTypes.Issue) { if (e.Node.Type == "email") { if (e.Node.Attributes.ContainsKey("Outgoing")) { e.IsEnabled = true; e.IsVisible = true; } } } break; #endregion #region Resolution case "Resolution": if (iObjTypeId == (int)ObjectTypes.Issue) { if (!e.Node.Attributes.ContainsKey("Resolution") && !e.Node.Attributes.ContainsKey("Question")) { e.IsEnabled = true; e.IsVisible = true; } } break; #endregion #region UnResolution case "UnResolution": if (iObjTypeId == (int)ObjectTypes.Issue) { if (e.Node.Attributes.ContainsKey("Resolution")) { e.IsEnabled = true; e.IsVisible = true; } } break; #endregion #region Workaround case "Workaround": if (iObjTypeId == (int)ObjectTypes.Issue) { if (!e.Node.Attributes.ContainsKey("Workaround") && !e.Node.Attributes.ContainsKey("Question")) { e.IsEnabled = true; e.IsVisible = true; } } break; #endregion #region UnWorkaround case "UnWorkaround": if (iObjTypeId == (int)ObjectTypes.Issue) { if (e.Node.Attributes.ContainsKey("Workaround")) { e.IsEnabled = true; e.IsVisible = true; } } break; #endregion #region OnTop case "OnTop": if (!e.Node.Attributes.ContainsKey(Node.ONTOP_ATTRIBUTE)) { e.IsEnabled = true; e.IsVisible = true; } break; #endregion #region UnOnTop case "UnOnTop": if (e.Node.Attributes.ContainsKey(Node.ONTOP_ATTRIBUTE)) { e.IsEnabled = true; e.IsVisible = true; } break; #endregion #region Delete case "Delete": if (iObjTypeId == (int)ObjectTypes.Issue) { bool CanUpdate = Incident.CanUpdate(iObjId); e.IsEnabled = CanUpdate; e.IsVisible = CanUpdate; e.IsBreak = true; } break; #endregion default: break; } }
private void Handle(ValidateArgs msg) { fileEnumerator.Tell(new EnumerateFiles(msg.Folders, msg.Extension)); }
public async Task ValidateArgsAddedAndSubTypes(Mock <IServiceCollection> mockColl, ValidateArgs args) { await DependencyConfig.Setup(args, null, mockColl.Object, false).ConfigureAwait(false); mockColl.Verify(m => m.Add(It.Is <ServiceDescriptor>(s => s.ServiceType == typeof(ValidateArgs))), Times.Once); mockColl.Verify(m => m.Add(It.Is <ServiceDescriptor>(s => s.ServiceType == typeof(LibraryTargetArgs))), Times.Once); mockColl.Verify(m => m.Add(It.Is <ServiceDescriptor>(s => s.ServiceType == typeof(FileArgsBase))), Times.Once); mockColl.Verify(m => m.Add(It.Is <ServiceDescriptor>(s => s.ServiceType == typeof(ArgsBase))), Times.Once); }