public void GetFileNameReturnsCorrectString() { const string DATE_FORMATTING = "yyy-MM-dd"; const string OPERATION_NAME = "mytestjob"; string EXPECTED_FILENAME = $"{OPERATION_NAME}-{DateTime.Now.ToString(DATE_FORMATTING)}.txt"; ISolrLog log = new SolrLog(new DirectoryInfo("/")); Assert.AreEqual(EXPECTED_FILENAME, log.GetFileName(OPERATION_NAME)); }
public void ValueReturnsTheProperCollectionString() { DirectoryInfo thisDirectory = new DirectoryInfo("./"); string operationName = $"mytestjob-{DateTime.Now.Ticks}"; ISolrLog log = new SolrLog(thisDirectory, false); Assert.IsTrue(string.IsNullOrEmpty(log.Value)); log.AppendSolrAction(DateTime.Now, DateTime.Now, operationName, new SolrResponseObject(null, null)); Assert.IsFalse(string.IsNullOrEmpty(log.Value)); }
public void WriteLogOutputsFile() { DirectoryInfo thisDirectory = new DirectoryInfo("./"); string operationName = $"mytestjob-{DateTime.Now.Ticks}"; ISolrLog log = new SolrLog(thisDirectory); log.WriteLog(operationName, "test"); Assert.IsTrue(File.Exists(thisDirectory.FullName + log.GetFileName(operationName))); File.Delete(thisDirectory.FullName + log.GetFileName(operationName)); }
public void AppendCancellationCallsReferralFunction() { DirectoryInfo thisDirectory = new DirectoryInfo("./"); ISolrLog log = new SolrLog(thisDirectory, false); int i = 0; ((SolrLog)log).OnLogAction += (x) => i++; Assert.AreEqual(0, i); log.AppendJobAction("", Interfaces.Enumerations.SolrLogAction.Stop); Assert.AreEqual(1, i); }
public void AppendActionCallsReferralFunction() { DirectoryInfo thisDirectory = new DirectoryInfo("./"); ISolrLog log = new SolrLog(thisDirectory, false); int i = 0; ((SolrLog)log).OnLogAction += (x) => i++; Assert.AreEqual(0, i); log.AppendSolrAction(DateTime.Now, DateTime.Now, "", new SolrResponseObject(null, null)); Assert.AreEqual(1, i); }