public void ExtensionsPacketsStoreNetwork() { Console.WriteLine("Clean machine."); BehaviorsRegression.CleanMachine(); using (var systemSettings = new SystemSettings()) { systemSettings.rawDataStoragePackets = NunitSettings.ShareFolder; systemSettings.packetDuration = 5; } Console.WriteLine("Install AT"); AT.Install(); Thread.Sleep(30000); Console.WriteLine("Check number of packets in custom folder."); var packets = AT.GetContentOfFolder(NunitSettings.ShareFolder, "*.packet"); Assert.IsTrue(packets.Count >= 9, "Incorrect quantity of packets:" + packets.Count); Console.WriteLine("Clean machine."); BehaviorsRegression.CleanMachine(); foreach (var packet in packets) { File.Delete(Path.Combine(NunitSettings.ShareFolder, packet.Name)); } }
public void DttCorruptedSystemSettings() { Console.WriteLine("Install AT"); BehaviorsRegression.CleanMachine(); AT.Install(); Console.WriteLine("Stop DTT and remove systemsettings"); Service.Stop(NunitSettings.ServiceDttName); SystemSettings.StoreSystemSettings(); SystemSettings.DeleteSystemSettings(); Service.Start(NunitSettings.ServiceDttName); Thread.Sleep(Delay); Service.Stop(NunitSettings.ServiceDttName); Console.WriteLine("Check log DTT"); var contentOfFolder = AT.GetContentOfFolder(_pathToLog, "*.log"); var countError = 0; var contentLog = ""; foreach (var fileInfo in contentOfFolder) { if (fileInfo.Name.Contains("Data Transfer Tool")) { countError = CountWordInFile(Path.Combine(_pathToLog, fileInfo.Name), "ERROR"); contentLog = File.ReadAllText(Path.Combine(_pathToLog, fileInfo.Name)); } } Assert.IsTrue(countError == 1); Assert.IsTrue(contentLog.Contains("Configuration file is absent or access is denied. Considering session as not intended for AT.")); Console.WriteLine("Restore systemsettings"); BehaviorsRegression.CleanMachine(); }
/// <summary> /// Private methoda /// </summary> /// <returns></returns> private string GetContentOfLog(string nameLog) { //change var listFiles = AT.GetContentOfFolder(Path.Combine(Path.Combine(NunitSettings.DttPath, AT.GetDate()), "LOGS"), "*" + nameLog + ".log"); foreach (var file in listFiles) { var text = File.ReadAllText(Path.Combine(Path.Combine(Path.Combine(NunitSettings.DttPath, AT.GetDate()), "LOGS"), file.Name)); return(text.Replace(" ", "").Replace("\r\n", "").Replace("\n", "").Replace("\r", "")); } return(null); }
private string GetNameOfLogFile() { var contentOfFolder = AT.GetContentOfFolder(_pathToLog, "*.log"); foreach (var fileInfo in contentOfFolder) { if (fileInfo.Name.Contains("Data Transfer Tool")) { return(fileInfo.Name); } } return(null); }
private static string GetTextDTTLog() { var content = AT.GetContentOfFolder(PathToLog, "*.log"); foreach (var fileInfo in content) { if (fileInfo.Name.Contains("Data Transfer")) { return(File.ReadAllText(Path.Combine(PathToLog, fileInfo.Name))); } } return(null); }
//TODO: must be redesinged. It is bad idea to use only the first file in the folder private string GetNameOfPacket(string path, string mask) { var contentOfFolder = AT.GetContentOfFolder(path, mask); return(contentOfFolder[0].Name); }