public void ChangeUiLanguage_LanguageIsNull_ShouldNotCallChangeUILanguageMethod()
        {
            //Arranage
            var sut           = new LanguageController(_mockLanguageService.Object);
            var languageModel = new LanguageViewModel()
            {
                Language = null
            };

            //Act
            sut.ChangeUiLanguage(languageModel, "test url");

            //Assert
            _mockLanguageService.Verify(x => x.ChangeUiLanguage(It.IsAny <HttpContext>(), It.IsAny <string>()), Times.Never);
        }
        public void ChangeUiLanguage_LanguageIsNotNull_ShouldCallChangeUILanguageMethod()
        {
            //Arranage
            var sut           = new LanguageController(_mockLanguageService.Object);
            var languageModel = new LanguageViewModel()
            {
                Language = "English"
            };
            //Act
            var returnedValue = sut.ChangeUiLanguage(languageModel, "test url");

            //Assert
            _mockLanguageService.Verify(x => x.ChangeUiLanguage(It.IsAny <HttpContext>(), languageModel.Language), Times.Once);
            var redirectResult = Assert.IsType <RedirectResult>(returnedValue);

            Assert.Equal("test url", redirectResult.Url);
        }
        public void ChangeUiLanguageTest(string language)
        {
            var languageModel = new LanguageViewModel
            {
                Language = language == string.Empty ? null : language
            };

            _languageServiceMock.Setup(l => l.ChangeUiLanguage(It.IsAny <HttpContext>(), It.IsAny <string>()));

            var result = _languageController.ChangeUiLanguage(languageModel, "Url");

            if (language != string.Empty)
            {
                _languageServiceMock.Verify(l => l.ChangeUiLanguage(It.IsAny <HttpContext>(), language));
            }
            else
            {
                _languageServiceMock.Verify(l => l.ChangeUiLanguage(It.IsAny <HttpContext>(), language), Times.Never);
            }
            var redirectResult = Assert.IsType <RedirectResult>(result);

            Assert.Equal("Url", redirectResult.Url);
        }