Renamed SettingsAndHelperFunctions to HelperFunctions

This commit is contained in:
Lukasz Baldyga committed 2020-11-29 08:24:54 +00:00
1 parent b290848034
commit e6722273a5
7 files changed
+18 -18

No files matched your search

@@ -31,7 +31,7 @@ namespace Advanced_Software_Engineering_Tests {
obfuscatedInput = RandomSpaces() + obfuscatedInput + RandomSpaces();
Assert.AreEqual(correctOutput, SettingsAndHelperFunctions.Strip(obfuscatedInput));
Assert.AreEqual(correctOutput, HelperFunctions.Strip(obfuscatedInput));
}
}
@@ -43,7 +43,7 @@ namespace Advanced_Software_Engineering_Tests {
string input = " a simple sentence surrounded by spaces ";
string expected = "a simple sentence surrounded by spaces";
Assert.AreEqual(expected, SettingsAndHelperFunctions.Strip(input));
Assert.AreEqual(expected, HelperFunctions.Strip(input));
}
/// <summary>
@@ -54,7 +54,7 @@ namespace Advanced_Software_Engineering_Tests {
string input = " a simple sentence surrounded by spaces ";
string expected = "a simple sentence surrounded by spaces";
Assert.AreEqual(expected, SettingsAndHelperFunctions.Strip(input));
Assert.AreEqual(expected, HelperFunctions.Strip(input));
}
/// <summary>
@@ -66,7 +66,7 @@ namespace Advanced_Software_Engineering_Tests {
string[] expected = (new List<string> { "a", "test", "t", "asdf" }).ToArray();
int i = 0;
foreach (string s in SettingsAndHelperFunctions.StripStringArray(input)) {
foreach (string s in HelperFunctions.StripStringArray(input)) {
Assert.AreEqual(expected[i++], s);
}
}
@@ -80,7 +80,7 @@ namespace Advanced_Software_Engineering_Tests {
string[] expected = (new List<string> { "a", "simple", "sentence", "surrounded", "by", "spaces" }).ToArray();
int i = 0;
foreach (string s in SettingsAndHelperFunctions.StripStringArray(input)) {
foreach (string s in HelperFunctions.StripStringArray(input)) {
Assert.AreEqual(expected[i++], s);
}
}
@@ -90,7 +90,7 @@ namespace Advanced_Software_Engineering_Tests {
/// </summary>
[TestMethod]
public void CommandAndParameterParser_Manual1() {
Dictionary<string, string[]> commands = SettingsAndHelperFunctions.CommandAndParameterParser("moveto 200, 200");
Dictionary<string, string[]> commands = HelperFunctions.CommandAndParameterParser("moveto 200, 200");
Assert.AreEqual("moveto", commands["command"][0]);
Assert.AreEqual("200", commands["parameters"][0]);
Assert.AreEqual("200", commands["parameters"][1]);
@@ -101,7 +101,7 @@ namespace Advanced_Software_Engineering_Tests {
/// </summary>
[TestMethod]
public void CommandAndParameterParser_Manual2() {
Dictionary<string, string[]> commands = SettingsAndHelperFunctions.CommandAndParameterParser("clear");
Dictionary<string, string[]> commands = HelperFunctions.CommandAndParameterParser("clear");
Assert.AreEqual("clear", commands["command"][0]);
Assert.IsFalse(commands.Keys.Contains("parameters"));
}
@@ -111,7 +111,7 @@ namespace Advanced_Software_Engineering_Tests {
/// </summary>
[TestMethod]
public void CommandAndParameterParser_Manual3() {
Dictionary<string, string[]> commands = SettingsAndHelperFunctions.CommandAndParameterParser("");
Dictionary<string, string[]> commands = HelperFunctions.CommandAndParameterParser("");
Assert.IsFalse(commands.Keys.Contains("command"));
Assert.IsFalse(commands.Keys.Contains("parameters"));
}
@@ -121,7 +121,7 @@ namespace Advanced_Software_Engineering_Tests {
/// </summary>
[TestMethod]
public void CommandAndParameterParser_Manual4() {
Dictionary<string, string[]> commands = SettingsAndHelperFunctions.CommandAndParameterParser(" genericCommand 2, 3,4 5");
Dictionary<string, string[]> commands = HelperFunctions.CommandAndParameterParser(" genericCommand 2, 3,4 5");
Assert.AreEqual("genericCommand", commands["command"][0]);
Assert.AreEqual("2", commands["parameters"][0]);
@@ -153,7 +153,7 @@ namespace Advanced_Software_Engineering_Tests {
input += RandomSpaces() + parameter + RandomSpaces() + "," + RandomSpaces();
}
Dictionary<string, string[]> commands = SettingsAndHelperFunctions.CommandAndParameterParser(input);
Dictionary<string, string[]> commands = HelperFunctions.CommandAndParameterParser(input);
Assert.AreEqual(command, commands["command"][0]);
@@ -142,7 +142,7 @@
<Compile Include="Windows\TextEditor.Designer.cs">
<DependentUpon>TextEditor.cs</DependentUpon>
</Compile>
<Compile Include="SettingsAndHelperFunctions.cs" />
<Compile Include="HelperFunctions.cs" />
<Compile Include="Windows\Menu.cs">
<SubType>Form</SubType>
</Compile>
@@ -24,7 +24,7 @@ namespace Advanced_Software_Engineering {
/// <summary>
/// This class simply provides settings and some functions that are used across many components.
/// </summary>
public class SettingsAndHelperFunctions {
public class HelperFunctions {
/// <summary>
/// This function removes spaces from the start and the end of the text. This should be unit tested.
@@ -60,7 +60,7 @@ namespace Advanced_Software_Engineering.Verbs.Value {
// bools have ==
if (!(type == "bool")) {
//Seperate the assignment from the variables
List<string> assignmentList = SettingsAndHelperFunctions.StripStringArray(assignment.Split("="[0]));
List<string> assignmentList = HelperFunctions.StripStringArray(assignment.Split("="[0]));
name = assignmentList[0];
value = ValueFactory.CreateValue(assignmentList[1], type);
} else {
@@ -61,7 +61,7 @@ namespace Advanced_Software_Engineering.Verbs.Value {
}
public static IValue CreateValue(Drawer drawer, string value) {
value = SettingsAndHelperFunctions.Strip(value);
value = HelperFunctions.Strip(value);
if (drawer.CheckVariableExists(value)) return new VariableValue(drawer, value);
else return ValueHelper.ConvertToIValue(value);
}
@@ -14,7 +14,7 @@ namespace Advanced_Software_Engineering.Verbs.Value {
/// <param name="text">String to be converted to int</param>
/// <returns>Integer representation of string</returns>
public static int ConvertToInt(string text) {
text = SettingsAndHelperFunctions.Strip(text);
text = HelperFunctions.Strip(text);
return int.Parse(text);
}
@@ -24,7 +24,7 @@ namespace Advanced_Software_Engineering.Verbs.Value {
/// <param name="text">String to be converted to double</param>
/// <returns>Double representation of string</returns>
public static double ConvertToDouble(string text) {
text = SettingsAndHelperFunctions.Strip(text);
text = HelperFunctions.Strip(text);
return double.Parse(text);
}
@@ -121,7 +121,7 @@ namespace Advanced_Software_Engineering.Verbs.Value {
}
public static IValue ConvertToIValue(string text) {
text = SettingsAndHelperFunctions.Strip(text);
text = HelperFunctions.Strip(text);
//No assignmnet
if (!text.Contains("=")) {
if (!text.Contains("#")) {
@@ -22,7 +22,7 @@ namespace Advanced_Software_Engineering {
/// <param name="fullCommand">The command as a string</param>
/// <returns>A IVerb that maches the command</returns>
public static IVerb MakeVerb(Drawer drawer, string fullCommand) {
CommandAndParameterParserResult result = SettingsAndHelperFunctions.CommandAndParameterParser(fullCommand);
CommandAndParameterParserResult result = HelperFunctions.CommandAndParameterParser(fullCommand);
string command = result.getCommand();
string[] commandParameters = result.getParameters();