public async Task DeleteLanguage_LanguageExists_Returns_OkResult()
        {
            _languageService.Setup(s => s.Remove((It.IsAny <int>()))).ReturnsAsync(true);

            var result = await _languageController.DeleteLanguage(It.IsAny <int>());

            result.Should().BeOfType <OkResult>();
        }
Пример #2
0
        protected void Delete_Click(object sender, EventArgs e)
        {
            LinkButton         btn        = (LinkButton)sender;
            int                LanguageID = int.Parse(btn.CommandArgument);
            LanguageController dc         = new LanguageController();

            dc.DeleteLanguage(LanguageID);
            rptLanguages.DataSource = dc.GetLanguages();
            rptLanguages.DataBind();
        }
Пример #3
0
        public async Task Language_Create_Response()
        {
            //Arrange
            var dbContext = await GetDataContext();

            var controller = new LanguageController(dbContext);
            //Act
            var langForAdding = new Language()
            {
                Lang = "New Lang"
            };
            var response = controller.CreateLanguage(langForAdding).Result;

            //Assert
            Assert.Equal(response.Lang, langForAdding.Lang);

            int deletingId = response.Id;

            var langResponse1 = controller.DeleteLanguage(deletingId).Result;

            //Assert
            Assert.Equal(langResponse1, deletingId);
        }