Beispiel #1
0
 public void Initialize()
 {
     Submissions.ResetSubmissions();
     TestCases.ResetTestCases();
     s1 = new SingleSubmission("21325");
     s1.AddCode(@"..\..\..\Assets\Test Required FIles\SubmissionsTest\Source.c");
     Submissions.submissions.Add(s1);
 }
 public void Initialize()
 {
     Submissions.ResetSubmissions();
     TestCases.ResetTestCases();
     s1 = new SingleTestCase("7 6", "12", true);
     s2 = new SingleTestCase("__[Bound]3 5 10", "10", true);
     s3 = new SingleTestCase("__[EP]3 9 17", "19", true);
 }
 public void Initialize()
 {
     Submissions.ResetSubmissions();
     TestCases.ResetTestCases();
     fileToCheckContent = File.ReadAllText(@"..\..\..\Assets\Test Required FIles\TestCasesTest\GeneralTestCasesExample.txt");
     TestCases.ResetTestCases();
     //inputFileToCheckContent = File.ReadAllText(@"..\..\..\Assets\Test Required FIles\TestCasesTest\InputTestCasesExample.txt");
     //outputFileToCheckContent = File.ReadAllText(@"..\..\..\Assets\Test Required FIles\TestCasesTest\OutputTestCasesExample.txt");
 }
        public void RemoveTCTNC_Removed()
        {
            //Arrange
            var testCase = "__[TC]\r\n3 4";
            //Act
            var result = TestCases.RemoveTCTNC(testCase);

            //Assert
            Assert.AreEqual("3 4", result);
        }
        public void TC_or_TNC_ContainsEither()
        {
            //Arrange
            //Act
            var result1 = TestCases.TC_or_TNC("__[TC]\r\n4 5 6");
            var result2 = TestCases.TC_or_TNC("__[TNC]\r\n7");

            //Assert
            Assert.IsTrue(result1);
            Assert.IsFalse(result2);
        }
        public void CountTestCases_Test()
        {
            //Arrange
            //Act
            var result = TestCases.CountTestCases(fileToCheckContent);

            //Assert
            Assert.AreEqual(5, result);
            Assert.AreNotEqual(4, result);
            Assert.AreNotEqual(6, result);
        }
        public void TestCasesSeparator_Seperates()
        {
            //Arrange
            //Act
            var result = TestCases.TestCasesSeparator(fileToCheckContent);

            //Assert
            string[]      expected     = { "__[TC]\r\n9 5", "__[TNC]\r\n3 4\r\n1\r\n__[Bound] 5 9\r\n10", "__[TNC]\r\n7 3", "__[TC] 19\r\n", "__[TC] bla bla\r\n75" };
            List <string> expectedList = new List <string>(expected);

            CollectionAssert.AreEqual(expectedList, result);
        }
        public void TestCasesBuilder_AddedSuccessfully()
        {
            //Arrange
            var inputFileText  = "__[TC]\r\n3 4\r\n__[TC]\r\n35";
            var outputFileTest = "__[TC]\r\n1\r\n__[TC]\r\nWrong input";
            var listSize       = 2; //1 test case added

            //Act
            TestCases.TestCasesBuilder(inputFileText, outputFileTest);
            //Assert
            Assert.AreEqual(listSize, TestCases.testCases.Count);
        }
        public void TestCasesBuilder_NotAddedSuccessfully()
        {
            TestCases.ResetTestCases();
            //Arrange
            var inputFileText  = "__[TC]\r\n3 4\r\n__[TC]\r\n35";
            var outputFileTest = "__[TC]\r\n1";
            var listSize       = 2; //Suposedely 2 test cases (but tester forgot to add the output field)


            //Assert+Act
            Assert.ThrowsException <Exception>(() => TestCases.TestCasesBuilder(inputFileText, outputFileTest));
            Assert.AreNotEqual(listSize, TestCases.testCases.Count);
            Assert.AreEqual(0, TestCases.testCases.Count);
        }
        public void GetAllSingleSubmissionResults_Test()
        {
            string st = s2.GetAllSingleSubmissionResults();

            Assert.AreEqual("No results.", st);
            TestCases.OnAddTestCase("2", "2", false);
            s2.CompileSubmittedCode();
            s2.RunSubmittedProgram();
            s2.CorrectResultsCount();
            s2.CompareResultsToDesiredResults();
            string st2 = s2.GetAllSingleSubmissionResults();

            Assert.AreNotEqual("No results.", st2);
        }
        public void Initialize()
        {
            Submissions.ResetSubmissions();
            TestCases.ResetTestCases();
            s1 = new SingleSubmission("21325");
            s2 = new SingleSubmission("54324");
            s3 = new SingleSubmission("53252");
            s2.AddCode(@"..\..\..\Assets\Test Required FIles\SingleSubmissionTest\Source1.c");
            s2.AddExe(@"..\..\..\Assets\Test Required FIles\SingleSubmissionTest\Source1.exe");

            s3.AddExe(@"..\..\..\Assets\Test Required FIles\SingleSubmissionTest\Source2.exe");

            bool   isTC   = false;                        // TNC
            string input  = "Check input";                // This is a TNC and we know these vakues are incorrect output
            string output = "Check output";               // So we know the result will be true

            TestCases.OnAddTestCase(input, output, isTC); // We want the submisstion at least one currect result
            TestCases.OnAddTestCase(input, output, isTC); // We want the submisstion at least one currect result
        }
        public static void OnButtonAddTestCaseClick(RadioButton radioTC, RadioButton radioTNC, TextBox txtInputAppend, TextBox txtOutputAppend)
        {
            if (radioTC.Checked)
            {
                TestCases.OnAddTestCase(txtInputAppend.Text, txtOutputAppend.Text, true);
            }
            if (radioTNC.Checked)
            {
                TestCases.OnAddTestCase(txtInputAppend.Text, txtOutputAppend.Text, false);
            }


            if (txtInputAppend.Text != "" && txtOutputAppend.Text != "")
            {
                MessageBox.Show("Added a new test case!\r\n" +
                                "In order to save the new array of test cases (Both input and output files)\r\n" +
                                "please choose the Save new I/O options. \r\nMake sure you already have chosen input/output " +
                                "files since they will be saved in the same directory as your original files.");
            }
        }
Beispiel #13
0
 public void TestCleanup()
 {
     Submissions.ResetSubmissions();
     TestCases.ResetTestCases();
 }
Beispiel #14
0
 public void Initialize()
 {
     Submissions.ResetSubmissions();
     TestCases.ResetTestCases();
 }