public ActionResult SetDefaultSelection([FromBody] SelectDefaultLanguageViewModel model) { var userId = GetUser().Id; _selectedLanguagesRepository.SetDefaultLanguages(new SelectDefaultLanguageModel { DefaultBaseLanguage = model.BaseLanguage, DefaultTargetLanguage = model.TargetLanguage }, userId); return(Ok()); }
public void SetDefaultSelection_Should_Set_Default_Language() { // Arrange var fakeSelectDefaultLanguageModel = new SelectDefaultLanguageModel { DefaultBaseLanguage = 1 }; var fakeSelectDefaultLanguageViewModel = new SelectDefaultLanguageViewModel { BaseLanguage = 1 }; _mockRepo.Setup(repo => repo.SetDefaultLanguages(fakeSelectDefaultLanguageModel, 1)); // Act var methodResult = _mockController.SetDefaultSelection(fakeSelectDefaultLanguageViewModel); // Assert var testResult = methodResult as OkResult; Assert.Equal(200, testResult.StatusCode); }