public async Task Restore_Post_InvalidResponse()
        {
            // arrange
            MockLanguageService.Setup_RestoreLanguage_Returns_LanguageRestoreResponse_Invalid();

            // act
            var result = (JsonResult)await SystemUnderTest.Restore(OrganizationOneProjectOneUid, One);

            // assert
            ((CommonResult)result.Value).IsOk.ShouldBe(false);
            MockLanguageService.Verify_RestoreLanguage();
        }
        public void RevisionsData_GET_InvalidResponse()
        {
            // arrange
            MockLanguageService.Setup_GetLanguageRevisions_Returns_LanguageRevisionReadListResponse_Invalid();

            // act
            var result = SystemUnderTest.RevisionsData(OrganizationOneProjectOneUid);

            // assert
            AssertView <NotFoundResult>(result);
            MockLanguageService.Verify_GetLanguageRevisions();
        }
        public async Task Restore_Post()
        {
            // arrange
            MockLanguageService.Setup_RestoreLanguage_Returns_LanguageRestoreResponse_Success();

            // act
            var result = await SystemUnderTest.Restore(OrganizationOneProjectOneUid, One);

            // assert
            AssertView <JsonResult>(result);
            MockLanguageService.Verify_RestoreLanguage();
        }
        public async Task Revisions_GET_InvalidParameter()
        {
            // arrange
            MockLanguageService.Setup_GetLanguage_Returns_LanguageReadResponse_Success();

            // act
            var result = await SystemUnderTest.Revisions(EmptyUid);

            // assert
            AssertViewRedirectToHome(result);
            MockLanguageService.Verify_GetLanguage();
        }
        public void RevisionsData_GET()
        {
            // arrange
            MockLanguageService.Setup_GetLanguageRevisions_Returns_LanguageRevisionReadListResponse_Success();

            // act
            var result = SystemUnderTest.RevisionsData(OrganizationOneProjectOneUid);

            // assert
            AssertViewAndHeaders(result, new[] { "revision", "revisioned_by", "revisioned_at", "language_name", "2_char_code", "3_char_code", "icon", "created_at", "" });
            MockLanguageService.Verify_GetLanguageRevisions();
        }
        public async Task SelectData_GET_InvalidResponse()
        {
            // arrange
            MockLanguageService.Setup_GetLanguages_Returns_LanguageReadListResponse_Invalid();

            // act
            var result = await SystemUnderTest.SelectData(UidOne);

            // assert
            MockLanguageService.Verify_GetLanguages();
            AssertView <JsonResult>(result);
        }
        public async Task Revisions_GET()
        {
            // arrange
            MockLanguageService.Setup_GetLanguage_Returns_LanguageReadResponse_Success();

            // act
            var result = await SystemUnderTest.Revisions(OrganizationOneProjectOneUid);

            // assert
            AssertViewWithModel <LanguageRevisionReadListModel>(result);
            MockLanguageService.Verify_GetLanguage();
        }
        public async Task ListData_GET_SetPaging(int skip, int take)
        {
            // arrange
            MockLanguageService.Setup_GetLanguages_Returns_LanguageReadListResponse_Success();

            // act
            var result = (JsonResult)await SystemUnderTest.ListData(skip, take);

            // assert
            AssertView <DataResult>(result);
            AssertPagingInfo(result);
        }
        public void SelectData_GET()
        {
            // arrange
            MockLanguageService.Setup_GetLanguages_Returns_LanguageReadListResponse_Success();

            // act
            var result = SystemUnderTest.SelectData(UidOne);

            // assert
            AssertView <JsonResult>(result);
            MockLanguageService.Verify_GetLanguages();
        }
        public void ListData_GET_InvalidResponse()
        {
            // arrange
            MockLanguageService.Setup_GetLanguages_Returns_LanguageReadListResponse_Invalid();

            // act
            var result = SystemUnderTest.ListData(One, Two);

            // assert
            AssertView <NotFoundResult>(result);
            MockLanguageService.Verify_GetLanguages();
        }
        public void ListData_GET()
        {
            // arrange
            MockLanguageService.Setup_GetLanguages_Returns_LanguageReadListResponse_Success();

            // act
            var result = SystemUnderTest.ListData(One, Two);

            // assert
            AssertViewAndHeaders(result, new[] { "language_name", "2_char_code", "3_char_code", "icon", "" });
            MockLanguageService.Verify_GetLanguages();
        }
        public async Task Edit_GET_InvalidResponse()
        {
            // arrange
            MockLanguageService.Setup_GetLanguage_Returns_LanguageReadResponse_Invalid();

            // act
            var result = await SystemUnderTest.Edit(UidOne);

            // assert
            AssertViewAccessDenied(result);
            MockLanguageService.Verify_GetLanguage();
        }
        public async Task Edit_GET()
        {
            // arrange
            MockLanguageService.Setup_GetLanguage_Returns_LanguageReadResponse_Success();

            // act
            var result = await SystemUnderTest.Edit(UidOne);

            // assert
            AssertViewWithModel <LanguageEditModel>(result);
            MockLanguageService.Verify_GetLanguage();
        }
        public async Task Edit_POST_InvalidResponse()
        {
            // arrange
            MockLanguageService.Setup_EditLanguage_Returns_LanguageEditResponse_Invalid();
            var model = GetLanguageOneEditModel();

            // act
            var result = await SystemUnderTest.Edit(model);

            // assert
            AssertErrorMessagesForInvalidOrFailedResponse <LanguageEditModel>(result);
            MockLanguageService.Verify_EditLanguage();
        }
        public async Task Create_POST_FailedResponse()
        {
            // arrange
            MockHostingEnvironment.Setup(x => x.WebRootPath).Returns("");
            MockLanguageService.Setup_CreateLanguage_Returns_LanguageCreateResponse_Failed();
            var model = GetLanguageOneCreateModel();

            // act
            var result = await SystemUnderTest.Create(model);

            // assert
            AssertErrorMessagesForInvalidOrFailedResponse <LanguageCreateModel>(result);
            MockLanguageService.Verify_CreateLanguage();
        }
        public async Task Create_POST()
        {
            // arrange
            MockHostingEnvironment.Setup(x => x.WebRootPath).Returns("");
            MockLanguageService.Setup_CreateLanguage_Returns_LanguageCreateResponse_Success();
            var model = GetLanguageOneCreateModel();

            // act
            var result = await SystemUnderTest.Create(model);

            // assert
            ((RedirectResult)result).Url.ShouldBe("/Language/List/");
            MockLanguageService.Verify_CreateLanguage();
        }