public void TestAddtItemCode_Successfull() { var testAddtItemCode = new ItemCodesController(); Mocker.MockContextHeader(testAddtItemCode); string itemName = "Server"; string itemCode = "IT0300"; string CategoryID = "f1ced345-32aa-41f2-9045-90c02f2c209a"; JsonResult result = (JsonResult)testAddtItemCode.Add(itemName, itemCode, CategoryID); Console.WriteLine(result.Data); Assert.IsTrue((result.Data + "").Contains("All item codes")); }
public void TestAddtItemCode_Null_ItemCode() { var testAddtItemCode = new ItemCodesController(); Mocker.MockContextHeader(testAddtItemCode); string itemName = "Server"; string itemCode = ""; string CategoryID = ""; JsonResult result = (JsonResult)testAddtItemCode.Add(itemName, itemCode, CategoryID); Console.WriteLine(result.Data); Assert.IsTrue((result.Data + "").Contains("ItemCode is null")); }