public void RecordDataFileContentTest() { string getPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\..\..\")); string modelPath = getPath + "\\GoDiet\\DietData\\DataModel\\modelPath"; BinaryClassML.RecordData(modelPath, ""); InitialWindow.SetUsername = "******"; string fileName = "binary_cl_" + InitialWindow.SetUsername.ToString() + ".txt"; string dataModelPath = Path.Combine(modelPath, fileName); string filePath = modelPath + "\\" + fileName; BinaryClassML.RecordData(modelPath, ""); string content = "Binary Classification Algorithm Data Record"; bool checkThis = false; using (StreamReader sr = new StreamReader(filePath)) { string contents = sr.ReadToEnd(); if (contents.Contains(content)) { checkThis = true; } } Assert.AreEqual(true, checkThis); }
public void RecordDataTest() { string getPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\..\..\")); string modelPath = getPath + "\\GoDiet\\DietData\\DataModel\\modelPath"; BinaryClassML.RecordData(modelPath, ""); Assert.AreEqual("Worked", BinaryClassML.check); }
public void RecordDataExceptionThrownTest() { try { string getPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\..\..\")); string modelPath = getPath + "\\DietData\\DataModel\\modelPath"; BinaryClassML.RecordData(modelPath, ""); Assert.Fail(); } catch (Exception) { } }
public void RecordDataIsFileTest() { string getPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\..\..\")); string modelPath = getPath + "\\GoDiet\\DietData\\DataModel\\modelPath"; BinaryClassML.RecordData(modelPath, ""); InitialWindow.SetUsername = "******"; string fileName = "binary_cl_" + InitialWindow.SetUsername.ToString() + ".txt"; string dataModelPath = Path.Combine(modelPath, fileName); string filePath = modelPath + "\\" + fileName; BinaryClassML.RecordData(modelPath, ""); Assert.IsTrue(File.Exists(filePath)); }