Пример #1
0
        public void InsertTestResults_TwoDistinctStudents_TwoRowsAffected()
        {
            MarkrApiBusinessLogic.DeleteTestResults(testIdForUnitTests);

            var testResults = Deserialize("TestInputs/InsertTestResults_TwoDistinctStudents_TwoRows.xml");

            var importResults = MarkrApiBusinessLogic.ImportTestResults(testResults);

            Assert.AreEqual(importResults.RowsParsed, 2);
            Assert.AreEqual(importResults.RowsAccepted, 2);
        }
Пример #2
0
        public ImportResults Post(MCQTestResults testResults)
        {
            // If testResults is null then it means XML body was either empty or XML parsing failed.
            // Either way, we need to return appropriate HTTP error
            if (testResults == null)
            {
                HttpResponseMessage message = new HttpResponseMessage(HttpStatusCode.BadRequest);
                message.Content = new StringContent("XML data not in correct format.");
                throw new HttpResponseException(message);
            }

            return(MarkrApiBusinessLogic.ImportTestResults(testResults));
        }
Пример #3
0
        public void InsertTestResults_TwoDuplicateStudents_CorrectOneInserted()
        {
            //The TestId 1 is reserved for test data. We should have appropriate error handling in the application to ensure that
            MarkrApiBusinessLogic.DeleteTestResults(testIdForUnitTests);

            var testResults = Deserialize("TestInputs/InsertTestResults_TwoDuplicateStudents_CorrectOneInserted.xml");

            var importResults = MarkrApiBusinessLogic.ImportTestResults(testResults);

            var testResultsInDB = MarkrApiBusinessLogic.GetTestResults(testIdForUnitTests);

            Assert.AreEqual(importResults.RowsParsed, 2);
            Assert.AreEqual(importResults.RowsAccepted, 2);
            Assert.AreEqual(testResultsInDB.Count, 1);
            Assert.IsTrue(testResultsInDB.Exists(r => r.MarksObtained == 13));
        }
Пример #4
0
 public Aggregates Get(int id)
 {
     return(MarkrApiBusinessLogic.GetAggregatesForTest(id));
 }