public void TrainingWordSuiteController_GetTest() { //Arrange var initial = new WordSuite() { Id = 1, Name = "Days of the week" }; var expected = new TrainingWordSuiteModel() { Id = 1, Name = "Days of the week", WordTranslations = new List <WordTranslationModel>() { new WordTranslationModel { Id = 1, OriginalWord = "sunday" }, new WordTranslationModel { Id = 1, OriginalWord = "monday" } } }; //Action Mock <IQuizWordSuiteMapper> testWordSuiteMapper = new Mock <IQuizWordSuiteMapper>(); Mock <ITrainingWordSuiteMapper> trainingWordSuiteMapper = new Mock <ITrainingWordSuiteMapper>(); Mock <IWordSuiteService> wordSuiteService = new Mock <IWordSuiteService>(); Mock <IWordProgressService> progressService = new Mock <IWordProgressService>(); Mock <IWordProgressMapper> progressMapper = new Mock <IWordProgressMapper>(); GenerateData("1", new[] { "NoRoles" }); TrainingWordSuiteController Controller = new TrainingWordSuiteController(testWordSuiteMapper.Object, trainingWordSuiteMapper.Object, wordSuiteService.Object, progressService.Object, progressMapper.Object); wordSuiteService.Setup(x => x.GetWithNotStudiedWords(1)).Returns(initial); testWordSuiteMapper .Setup(x => x.Map(initial)) .Returns(expected); var actual = Controller.GetTask(1); //Assert //Assert.AreEqual(expected, actual); }
public void TrainingWordSuiteController_GetTest() { //Arrange var initial = new WordSuite() { Id = 1, Name = "Days of the week" }; var expected = new TrainingWordSuiteModel() { Id = 1, Name = "Days of the week", WordTranslations = new List<WordTranslationModel>() { new WordTranslationModel { Id = 1, OriginalWord = "sunday" }, new WordTranslationModel { Id = 1, OriginalWord = "monday" } } }; //Action Mock<IQuizWordSuiteMapper> testWordSuiteMapper = new Mock<IQuizWordSuiteMapper>(); Mock<ITrainingWordSuiteMapper> trainingWordSuiteMapper = new Mock<ITrainingWordSuiteMapper>(); Mock<IWordSuiteService> wordSuiteService = new Mock<IWordSuiteService>(); Mock<IWordProgressService> progressService = new Mock<IWordProgressService>(); Mock<IWordProgressMapper> progressMapper = new Mock<IWordProgressMapper>(); GenerateData("1", new[] { "NoRoles" }); TrainingWordSuiteController Controller = new TrainingWordSuiteController(testWordSuiteMapper.Object, trainingWordSuiteMapper.Object, wordSuiteService.Object, progressService.Object, progressMapper.Object); wordSuiteService.Setup(x => x.GetWithNotStudiedWords(1)).Returns(initial); testWordSuiteMapper .Setup(x => x.Map(initial)) .Returns(expected); var actual = Controller.GetTask(1); //Assert //Assert.AreEqual(expected, actual); }