public void TestConstructor() { AnswerQuizQuestionViewModel TestModel = new AnswerQuizQuestionViewModel(testQuiz) { }; Assert.That(TestModel.SelectedQuiz.QuizID, Is.EqualTo(2)); Assert.That(TestModel.SelectedQuiz.Description, Is.EqualTo("TestDescribtion")); Assert.That(TestModel.SelectedQuiz.Name, Is.EqualTo("TestQuiz")); }
public async void testAddUpdateRemove() { AnswerQuizQuestionViewModel TestModel = new AnswerQuizQuestionViewModel(testQuiz) { }; Assert.That(TestModel.SelectedQuiz.QuizID, Is.EqualTo(2)); // Sikre rigtige bruger Rating testRating = new Rating() { Reason = "Mangler UT", RatingID = 999, Rating1 = 1 }; await data.Rating.Add(testRating); //Gemmer Quiz Rating newrating = await data.Rating.GetAsync(999); //henter Quiz med ID 2 Assert.That(newrating.Reason, Is.EqualTo("Mangler UT")); Assert.That(newrating.Rating1, Is.EqualTo(1)); Assert.That(newrating.RatingID, Is.EqualTo(999)); //update testes her Rating testChangedRating = new Rating() { Reason = "Mangler Flere UT", RatingID = 999, Rating1 = 2 }; await data.Rating.Update(999, testChangedRating); //ændre quizzen Rating assertRating = await data.Rating.GetAsync(999); //henter den ændrede Quiz Assert.That(assertRating.Reason, Is.EqualTo("Mangler Flere UT")); Assert.That(assertRating.Rating1, Is.EqualTo(2)); Assert.That(assertRating.RatingID, Is.EqualTo(999)); //delete testes her List <Rating> resultList = new List <Rating>(); resultList = await data.Rating.GetAllAsync(); int currentSize = resultList.Count; data.Rating.Remove(999); resultList = await data.Rating.GetAllAsync(); Assert.That(resultList.Count, Is.EqualTo(currentSize - 1)); }
public async void testGetAllAsync() { AnswerQuizQuestionViewModel TestModel = new AnswerQuizQuestionViewModel(testQuiz) { }; Assert.That(TestModel.SelectedQuiz.QuizID, Is.EqualTo(2)); List <Rating> resultList = new List <Rating>(); resultList = await data.Rating.GetAllAsync(); Assert.That(resultList.Count, Is.EqualTo(2)); }
public async void testGetAsync() { AnswerQuizQuestionViewModel TestModel = new AnswerQuizQuestionViewModel(testQuiz) { }; Assert.That(TestModel.SelectedQuiz.QuizID, Is.EqualTo(2)); Rating Rating = new Rating(); Rating = await data.Rating.GetAsync(1); Assert.That(Rating.Reason, Is.EqualTo("den er super god, føler jeg har læst alt op")); Assert.That(Rating.RatingID, Is.EqualTo(1)); Assert.That(Rating.Rating1, Is.EqualTo(5)); Assert.That(Rating.QuizID, Is.EqualTo(2)); }
public async void testAddUpdateRemove() { AnswerQuizQuestionViewModel TestModel = new AnswerQuizQuestionViewModel(testQuiz) { }; Assert.That(TestModel.SelectedQuiz.QuizID, Is.EqualTo(2)); // Sikre rigtige bruger Userr testUser = new Userr() { UserID = 999, UserName = "******", Password = "******", EmailAdress = "*****@*****.**", StudentNumber = "1337", Salt = "No scooped by a 9 year old" }; await data.User.Add(testUser); //Gemmer bruger Userr resultUser = await data.User.GetAsync(999); //henter Quiz med ID 2 Assert.That(resultUser.UserID, Is.EqualTo(999)); Assert.That(resultUser.UserName, Is.EqualTo("Test Bruger")); Assert.That(resultUser.Password, Is.EqualTo("1337M4CH1N3")); Assert.That(resultUser.EmailAdress, Is.EqualTo("*****@*****.**")); Assert.That(resultUser.StudentNumber, Is.EqualTo("1337")); Assert.That(resultUser.Salt, Is.EqualTo("No scooped by a 9 year old")); //update testes her Userr testChangedUser = new Userr() { UserID = 999, UserName = "******", Password = "******", EmailAdress = "*****@*****.**", StudentNumber = "13375", Salt = "No scooped by a 8 year old" }; await data.User.Update(999, testChangedUser); //ændre quizzen Userr assertUser = await data.User.GetAsync(999); //henter den ændrede Quiz Assert.That(assertUser.UserID, Is.EqualTo(999)); Assert.That(assertUser.UserName, Is.EqualTo("Test Bruger1")); Assert.That(assertUser.Password, Is.EqualTo("1337M4CH1N35")); Assert.That(assertUser.EmailAdress, Is.EqualTo("*****@*****.**")); Assert.That(assertUser.StudentNumber, Is.EqualTo("13375")); Assert.That(assertUser.Salt, Is.EqualTo("No scooped by a 8 year old")); //delete testes her List <Userr> resultList = new List <Userr>(); resultList = await data.User.GetAllAsync(); int currentSize = resultList.Count; data.User.Remove(999); resultList = await data.User.GetAllAsync(); Assert.That(resultList.Count, Is.EqualTo(currentSize - 1)); }