public IHttpActionResult DeleteSkill(long skillId)
 {
     try
     {
         return(Ok(_skillService.DeleteSkill(skillId)));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
Пример #2
0
        public async Task ExceptionTestFor_DeleteSkill_Fail()
        {
            try
            {
                _skill = null;

                var result = await _skillService.DeleteSkill(_skill.SkillName);

                if (result == 1)
                {
                    testResult = "ExceptionTestFor_DeleteSkill_Fail=" + "False";
                    fileUtility.WriteTestCaseResuItInText(testResult);
                    // Write test case result in xml file
                    if (config["env"] == "development")
                    {
                        cases newcase = new cases
                        {
                            TestCaseType   = "Exception",
                            Name           = "ExceptionTestFor_DeleteSkill_Fail",
                            expectedOutput = "False",
                            weight         = 5,
                            mandatory      = "False",
                            desc           = "na"
                        };
                        await fileUtility.WriteTestCaseResuItInXML(newcase);
                    }
                }
                else
                {
                    Assert.NotEqual(1, result);
                }
            }
            catch (Exception exception)
            {
                var res = exception.Message;
                testResult = "ExceptionTestFor_DeleteSkill_Fail=" + "True";
                fileUtility.WriteTestCaseResuItInText(testResult);
                // Write test case result in xml file
                if (config["env"] == "development")
                {
                    cases newcase = new cases
                    {
                        TestCaseType   = "Exception",
                        Name           = "ExceptionTestFor_DeleteSkill_Fail",
                        expectedOutput = "True",
                        weight         = 5,
                        mandatory      = "True",
                        desc           = "na"
                    };
                    await fileUtility.WriteTestCaseResuItInXML(newcase);
                }
            }
        }
Пример #3
0
        // DELETE: api/Skills/5
        public GenericResponse <string> DeleteSkill(int id)
        {
            if (service.DeleteSkill(id) == 1)
            {
                return(new GenericResponse <string>
                {
                    StatusCode = 200,
                    Message = "NO CONTENT"
                });
            }

            return(new GenericResponse <string>
            {
                StatusCode = 500,
                Message = "SERVER ERROR"
            });
        }
Пример #4
0
        public async Task DeleteSkillTest()
        {
            // Arrange
            var skillId = 3;
            var client  = SetupMock_Skill();
            var config  = new Mock <IConfiguration>();

            client.BaseAddress = new Uri("https://localhost:1111/");
            config.SetupGet(s => s["SkillsURL"]).Returns("https://localhost:1111/");
            var service = new SkillService(null, new NullLogger <SkillService>(), config.Object)
            {
                Client = client
            };

            // Act
            var result = await service.DeleteSkill(skillId);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(skillId, result);
        }