Ejemplo n.º 1
0
        public async Task ExceptionTestFor_AddNewSkill_Fail()
        {
            try
            {
                _skill = null;


                var result = await _skillService.AddNewSkill(_skill);

                if (result == "New Skill Added")
                {
                    testResult = "ExceptionTestFor_AddNewSkill_Fail=" + "False";
                    fileUtility.WriteTestCaseResuItInText(testResult);
                    // Write test case result in xml file
                    if (config["env"] == "development")
                    {
                        cases newcase = new cases
                        {
                            TestCaseType   = "Exception",
                            Name           = "ExceptionTestFor_AddNewSkill_Fail",
                            expectedOutput = "False",
                            weight         = 5,
                            mandatory      = "False",
                            desc           = "na"
                        };
                        await fileUtility.WriteTestCaseResuItInXML(newcase);
                    }
                }
                else
                {
                    Assert.NotEqual("New Skill Added", result);
                }
            }
            catch (Exception exception)
            {
                var res = exception.Message;
                testResult = "ExceptionTestFor_AddNewSkill_Fail=" + "True";
                fileUtility.WriteTestCaseResuItInText(testResult);
                // Write test case result in xml file
                if (config["env"] == "development")
                {
                    cases newcase = new cases
                    {
                        TestCaseType   = "Exception",
                        Name           = "ExceptionTestFor_AddNewSkill_Fail",
                        expectedOutput = "True",
                        weight         = 5,
                        mandatory      = "True",
                        desc           = "na"
                    };
                    await fileUtility.WriteTestCaseResuItInXML(newcase);
                }
            }
        }