public void ShouldInsertTests() { // Given var db = new DataBaseMicrosoft(DataBasesTypes.MicrosoftAccess, TestHelper.CreateTempFile()); var test = new Test("Пробный Тест", 70); var questions = new[] { new Question("Вопрос 1"), new Question("Вопрос 2") }; var expected = new[] { new Test("Первый тест", 100), new Test("Пробный Тест", 70) }; // When test.SetQuestions(questions); test.SetComponent(new Component("", 1)); questions[0].SetAssessments(new Assessments()); questions[1].SetAssessments(new Assessments()); var status = db.ExecuteCommand(Parameters.Insert, test); var actual = db.GetElements<Test>(); db.FillElement(actual[1]); TestHelper.DeleteTemp(); // Then Assert.AreEqual(0, status.ExitCode); Assert.IsNull(status.ErrorMessage); Assert.AreEqual(expected.Length, actual.Length); Assert.IsInstanceOf<Test>(actual[0]); CollectionAssert.AreEqual(expected, actual); CollectionAssert.AreEqual(questions, actual[1].Questions); }
public void ShouldGetTestList() { // Given var db = new DataBaseMicrosoft(DataBasesTypes.MicrosoftAccess, TestHelper.CreateTempFile()); var expected = new Test("Первый тест", 100); // When var actual = db.GetElements<Test>().Last(); TestHelper.DeleteTemp(); // Then Assert.AreEqual(expected, actual); }
public TestProgress(Test test) { _test = test; _currentIndex = 0; }