public void Initialize() { Database.SetInitializer(new DropCreateDatabaseAlways <ChineseTrainerContext>()); var testSetupContext = new ChineseTrainerContext(TestDatabaseName); Guard <Dictionary>(testSetupContext); Guard <DictionaryEntry>(testSetupContext); Guard <Translation>(testSetupContext); Guard <Highscore>(testSetupContext); Guard <Answer>(testSetupContext); var dictionary1 = CreateDictionary("1"); testSetupContext.Add(dictionary1); var dictionary2 = CreateDictionary("2"); testSetupContext.Add(dictionary2); var highscore = CreateHighscore(dictionary1); testSetupContext.Add(highscore); _questionResultId = highscore.QuestionResult.Id; foreach (var answer in highscore.QuestionResult.Answers) { testSetupContext.Add(answer); } testSetupContext.SaveChanges(); }
public void Initialize() { Database.SetInitializer(new DropCreateDatabaseAlways <ChineseTrainerContext>()); var objectUnderTest = new ChineseTrainerContext(TestDatabaseName); Guard <Dictionary>(objectUnderTest); Guard <DictionaryEntry>(objectUnderTest); Guard <Translation>(objectUnderTest); Guard <Highscore>(objectUnderTest); Guard <User>(objectUnderTest); var dictionary1 = CreateDictionary("1"); objectUnderTest.Add(typeof(Dictionary), dictionary1); var dictionary2 = CreateDictionary("2"); objectUnderTest.Add(typeof(Dictionary), dictionary2); var highscore = CreateHighscore(dictionary1); objectUnderTest.Add(typeof(Highscore), highscore); objectUnderTest.SaveChanges(); }
public void AddQuestionResult(QuestionResult questionResult) { ChineseTrainerContext.Add(questionResult); ChineseTrainerContext.SaveChanges(); }
public void AddHighscore(Highscore highscore) { ChineseTrainerContext.Add(highscore); ChineseTrainerContext.SaveChanges(); }
public void AddDictionaryEntry(DictionaryEntry dictionaryEntry) { ChineseTrainerContext.Add(dictionaryEntry); ChineseTrainerContext.SaveChanges(); }
public void AddAnswer(Answer answer) { ChineseTrainerContext.Add(answer); ChineseTrainerContext.SaveChanges(); }