public void IfUserSetDebugOptionRequestAndErrorsShouldBeWritedToTrace() { var localName = "sample.avi"; var remoteName = "TestPostAppendVideo.avi"; var fullName = Path.Combine(this.dataFolder, remoteName); var fullNameToAppend = Path.Combine(this.dataFolder, "videoForAppend.mp4"); var destFileName = Path.Combine(BaseTestOutPath, remoteName); AppendOptions options = new AppendOptions(); this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName)); this.StorageApi.PutCreate(fullNameToAppend, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + "sample.mp4")); options.VideoToAppendPath = fullNameToAppend; var request = new PostAppendVideoRequest(remoteName, destFileName, options, this.dataFolder); var api = this.GetDebugApi(); var mockFactory = new MockFactory(); var traceListenerMock = mockFactory.CreateMock <TraceListener>(); Trace.Listeners.Add(traceListenerMock.MockObject); traceListenerMock.Expects.One.Method(p => p.WriteLine(string.Empty)).With(Is.StringContaining("POST: http://api-dev.aspose.cloud/v1.1/video/TestPostAppendVideo.avi")); traceListenerMock.Expects.One.Method(p => p.WriteLine(string.Empty)).With(Is.StringContaining("Response 200: OK")); traceListenerMock.Expects.AtLeastOne.Method(p => p.WriteLine(string.Empty)).With(Is.Anything); // Act api.PostAppendVideo(request); // Assert mockFactory.VerifyAllExpectationsHaveBeenMet(); }
/// <summary> /// Initializes a new instance of the <see cref="PostAppendVideoRequest"/> class. /// </summary> /// <param name="name">Original video name.</param> /// <param name="destinationPath">Path where to save the result file.</param> /// <param name="appendOptions">Append options. </param> /// <param name="folder">Original video folder.</param> /// <param name="storage">File storage, which have to be used.</param> /// <param name="destFileName">Result name of the document after the operation. If this parameter is omitted then result of the operation will be saved as the source document.</param> public PostAppendVideoRequest(string name, string destinationPath, AppendOptions appendOptions, string folder = null, string storage = null, string destFileName = null) { this.Name = name; this.DestinationPath = destinationPath; this.AppendOptions = appendOptions; this.Folder = folder; this.Storage = storage; this.DestFileName = destFileName; }
public void TestPostAppendVideo() { var localName = "sample.avi"; var remoteName = "TestPostAppendVideo.avi"; var fullName = Path.Combine(this.dataFolder, remoteName); var fullNameToAppend = Path.Combine(this.dataFolder, "videoForAppend.mp4"); var destFileName = Path.Combine(BaseTestOutPath, remoteName); AppendOptions options = new AppendOptions(); this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName)); this.StorageApi.PutCreate(fullNameToAppend, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + "sample.mp4")); options.VideoToAppendPath = fullNameToAppend; var request = new PostAppendVideoRequest(remoteName, destFileName, options, this.dataFolder); var actual = this.VideoApi.PostAppendVideo(request); Assert.AreEqual(200, System.Convert.ToInt32(actual.Code.ToString())); }
public virtual bool AddData <VType>(IList <VType> values, string seperator, string appendChar, AppendOptions appendOps, bool encloseIfBrackets) { bool ret = false; if (values == null) { return(ret); } if (values.Count == 0) { return(ret); } if (seperator == null) { seperator = ""; } if (appendChar == null || appendOps == AppendOptions.None) { appendChar = ""; } seperator += " "; string v = null; StringBuilder sb = new StringBuilder(); try { foreach (VType vt in values) { v = vt.GetType() == typeof(DateTime) ? ((DateTime)(object)vt).ToString("yyyy-mm-dd") : vt.ToString(); v = v == null ? "" : v; switch (appendOps) { case AppendOptions.None: { sb.Append(string.Format("{0}{1}", v, seperator)); break; } case AppendOptions.First: { sb.Append(string.Format("{0}{1}{2}", appendChar, v, seperator)); break; } case AppendOptions.Last: { sb.Append(string.Format("{0}{1}{2}", v, appendChar, seperator)); break; } case AppendOptions.Both: { string s2 = appendChar; if (encloseIfBrackets) { if (appendChar.Contains("(")) { s2 = ")"; } else if (appendChar.Contains("[")) { s2 = "]"; } else if (appendChar.Contains("{")) { s2 = "}"; } } sb.Append(string.Format("{0}{1}{2}{3}", appendChar, v, s2, seperator)); break; } } } string add = sb.ToString().TrimEnd(seperator.ToCharArray()); this._list.Add(add); ret = true; } catch { ret = false; } return(ret); }