Private
Public Access
Wrote further unit tests
This commit is contained in:
1 parent
0dcac3f12b
commit
79127c80d7
2 files changed
+88
-6
No files matched your search
@@ -19,8 +19,8 @@ namespace Advanced_Software_Engineering_Tests {
|
|||||||
{"lineto", new int[] { 2 } },
|
{"lineto", new int[] { 2 } },
|
||||||
{"shape", new int[] { 2, 3 } },
|
{"shape", new int[] { 2, 3 } },
|
||||||
|
|
||||||
{"square", new int[] { 1, 2 } },
|
{"square", new int[] { 1, 2, 8 } },
|
||||||
{"rectangle", new int[] { 2, 3 } },
|
{"rectangle", new int[] { 1, 2, 6 } },
|
||||||
{"circle", new int[] { 1 } },
|
{"circle", new int[] { 1 } },
|
||||||
{"triangle", new int[] { 1, 2 } },
|
{"triangle", new int[] { 1, 2 } },
|
||||||
{"dot", new int[] { 0 } },
|
{"dot", new int[] { 0 } },
|
||||||
@@ -184,13 +184,79 @@ namespace Advanced_Software_Engineering_Tests {
|
|||||||
Assert.AreEqual(correctDesc, verbDesc);
|
Assert.AreEqual(correctDesc, verbDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void SquareTester_Manual1() {
|
||||||
|
string input = "square 500";
|
||||||
|
|
||||||
|
Verb verb = VerbFactory.MakeVerb(null, input);
|
||||||
|
|
||||||
|
string verbDesc = verb.GetDescription();
|
||||||
|
|
||||||
|
int sides = 4;
|
||||||
|
double scale = 500;
|
||||||
|
double offset = 0 * Math.PI / 180;
|
||||||
|
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||||
|
|
||||||
|
Assert.AreEqual(correctDesc, verbDesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void SquareTester_Manual2() {
|
||||||
|
string input = "square 500, 45";
|
||||||
|
|
||||||
|
Verb verb = VerbFactory.MakeVerb(null, input);
|
||||||
|
|
||||||
|
string verbDesc = verb.GetDescription();
|
||||||
|
|
||||||
|
int sides = 4;
|
||||||
|
double scale = 500;
|
||||||
|
double offset = 45 * Math.PI / 180;
|
||||||
|
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||||
|
|
||||||
|
Assert.AreEqual(correctDesc, verbDesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TriangleTester_Manual1() {
|
||||||
|
string input = "triangle 500";
|
||||||
|
|
||||||
|
Verb verb = VerbFactory.MakeVerb(null, input);
|
||||||
|
|
||||||
|
string verbDesc = verb.GetDescription();
|
||||||
|
|
||||||
|
int sides = 3;
|
||||||
|
double scale = 500;
|
||||||
|
double offset = 0 * Math.PI / 180;
|
||||||
|
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||||
|
|
||||||
|
Assert.AreEqual(correctDesc, verbDesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TriangleTester_Manual2() {
|
||||||
|
string input = "triangle 500, 45";
|
||||||
|
|
||||||
|
Verb verb = VerbFactory.MakeVerb(null, input);
|
||||||
|
|
||||||
|
string verbDesc = verb.GetDescription();
|
||||||
|
|
||||||
|
int sides = 3;
|
||||||
|
double scale = 500;
|
||||||
|
double offset = 45 * Math.PI / 180;
|
||||||
|
string correctDesc = "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
|
||||||
|
|
||||||
|
Assert.AreEqual(correctDesc, verbDesc);
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void DotTester_Manual1() {
|
public void DotTester_Manual1() {
|
||||||
string input = "";
|
string input = "dot";
|
||||||
string[] inputParameters = { };
|
|
||||||
Verb verb = VerbFactory.MakeVerb(null, input);
|
Verb verb = VerbFactory.MakeVerb(null, input);
|
||||||
string verbDesc = verb.GetDescription();
|
string verbDesc = verb.GetDescription();
|
||||||
string correctDesc = null; //undecided
|
string correctDesc = "Dots the pen at pen position"; //undecided
|
||||||
|
|
||||||
|
Assert.AreEqual(correctDesc, verbDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
@@ -200,6 +266,8 @@ namespace Advanced_Software_Engineering_Tests {
|
|||||||
Verb verb = VerbFactory.MakeVerb(null, input);
|
Verb verb = VerbFactory.MakeVerb(null, input);
|
||||||
string verbDesc = verb.GetDescription();
|
string verbDesc = verb.GetDescription();
|
||||||
string correctDesc = null; //undecided
|
string correctDesc = null; //undecided
|
||||||
|
|
||||||
|
Assert.AreEqual(correctDesc, verbDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
@@ -209,6 +277,8 @@ namespace Advanced_Software_Engineering_Tests {
|
|||||||
Verb verb = VerbFactory.MakeVerb(null, input);
|
Verb verb = VerbFactory.MakeVerb(null, input);
|
||||||
string verbDesc = verb.GetDescription();
|
string verbDesc = verb.GetDescription();
|
||||||
string correctDesc = null; //undecided
|
string correctDesc = null; //undecided
|
||||||
|
|
||||||
|
Assert.AreEqual(correctDesc, verbDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
@@ -218,6 +288,8 @@ namespace Advanced_Software_Engineering_Tests {
|
|||||||
Verb verb = VerbFactory.MakeVerb(null, input);
|
Verb verb = VerbFactory.MakeVerb(null, input);
|
||||||
string verbDesc = verb.GetDescription();
|
string verbDesc = verb.GetDescription();
|
||||||
string correctDesc = null; //undecided
|
string correctDesc = null; //undecided
|
||||||
|
|
||||||
|
Assert.AreEqual(correctDesc, verbDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
@@ -227,6 +299,8 @@ namespace Advanced_Software_Engineering_Tests {
|
|||||||
Verb verb = VerbFactory.MakeVerb(null, input);
|
Verb verb = VerbFactory.MakeVerb(null, input);
|
||||||
string verbDesc = verb.GetDescription();
|
string verbDesc = verb.GetDescription();
|
||||||
string correctDesc = null; //undecided
|
string correctDesc = null; //undecided
|
||||||
|
|
||||||
|
Assert.AreEqual(correctDesc, verbDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
@@ -236,6 +310,8 @@ namespace Advanced_Software_Engineering_Tests {
|
|||||||
Verb verb = VerbFactory.MakeVerb(null, input);
|
Verb verb = VerbFactory.MakeVerb(null, input);
|
||||||
string verbDesc = verb.GetDescription();
|
string verbDesc = verb.GetDescription();
|
||||||
string correctDesc = null; //undecided
|
string correctDesc = null; //undecided
|
||||||
|
|
||||||
|
Assert.AreEqual(correctDesc, verbDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
@@ -244,7 +320,9 @@ namespace Advanced_Software_Engineering_Tests {
|
|||||||
string[] inputParameters = { };
|
string[] inputParameters = { };
|
||||||
Verb verb = VerbFactory.MakeVerb(null, input);
|
Verb verb = VerbFactory.MakeVerb(null, input);
|
||||||
string verbDesc = verb.GetDescription();
|
string verbDesc = verb.GetDescription();
|
||||||
string correctDesc = "Move origin to " + inputParameters[0] + ", " + inputParameters[1];
|
string correctDesc = "Create a new method";
|
||||||
|
|
||||||
|
Assert.AreEqual(correctDesc, verbDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
@@ -254,6 +332,8 @@ namespace Advanced_Software_Engineering_Tests {
|
|||||||
Verb verb = VerbFactory.MakeVerb(null, input);
|
Verb verb = VerbFactory.MakeVerb(null, input);
|
||||||
string verbDesc = verb.GetDescription();
|
string verbDesc = verb.GetDescription();
|
||||||
string correctDesc = null; //undecided
|
string correctDesc = null; //undecided
|
||||||
|
|
||||||
|
Assert.AreEqual(correctDesc, verbDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ namespace Advanced_Software_Engineering {
|
|||||||
|
|
||||||
Dictionary<string, string[]> commandAndParameters = SettingsAndHelperFunctions.CommandAndParameterParser(fullCommand);
|
Dictionary<string, string[]> commandAndParameters = SettingsAndHelperFunctions.CommandAndParameterParser(fullCommand);
|
||||||
|
|
||||||
|
if (!commandAndParameters.Keys.Contains("command")) throw new Exception("There is no command to process");
|
||||||
|
|
||||||
string command = commandAndParameters["command"][0];
|
string command = commandAndParameters["command"][0];
|
||||||
string[] parameters = commandAndParameters.Keys.Contains("parameters") ? commandAndParameters["parameters"] : new string[] { };
|
string[] parameters = commandAndParameters.Keys.Contains("parameters") ? commandAndParameters["parameters"] : new string[] { };
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user