public void ParseCorrectEventData([Values] FileProcessingState method, [Random(1)] int size) { var description = "this part will be ignored" + $", type = 0x00000020 (file-update), data = {{{{\r\n \"file\" : \"/usr/local\",\r\n \"method\" : {(int)method},\r\n \"size\" : {size}\r\n}}}}"; var parsed = _descriptionParser.Parse <FileProcessingUpdate>(description); Assert.That(parsed, Is.Not.Null); Assert.That(parsed.File, Is.EqualTo("/usr/local")); Assert.That(parsed.Method, Is.EqualTo(method)); Assert.That(parsed.Size, Is.EqualTo(size)); }
/// <summary> /// Construct of source file /// </summary> /// <param name="fileFullPath">Full path to report file</param> /// <param name="originalSource">Original file content source</param> /// <param name="state">Parser processor state</param> public SourceFile(T fileId, string fileFullPath, byte[] originalSource, FileProcessingState state = FileProcessingState.Unknown) : this(fileId) { var pathParts = fileFullPath.Split(new[] { '\\', '/' }); if (pathParts == null || pathParts.Length == 0) { FileName = fileFullPath; BaseLocation = "Unknown"; } else { FileName = pathParts[pathParts.Length - 1]; BaseLocation = string.Join("\\", pathParts.Take(pathParts.Length - 1)); } OriginalSource = originalSource; ProcessingState = state; }