public void CheckCommandTest1() { BlOrders order = new BlOrders(); bool status = order.CheckCommand("order 2 2 1", 1); Assert.IsFalse(status); }
public void CheckCommandTest() { var orderMoq = new Mock <IBlOrders>(); orderMoq.Setup(m => m.CheckCommand("order 1 1 1", 1)).Returns(true); orderMoq.Verify(); BlOrders order = new BlOrders(); bool status = order.CheckCommand("order 1 1 1", 1); Assert.IsTrue(status); }
public void OrderTest() { VendingItem item = new VendingItem(1, "Coke", V, 5); var helperMock = new Mock <IHelper>(); helperMock.Setup(x => x.PopulateItems()).Returns(new Dictionary <int, VendingItem>() { { 1, item } }); BlOrders order = new BlOrders(); Dictionary <int, VendingItem> dict = new Dictionary <int, VendingItem>(helperMock.Object.PopulateItems()); //{ { 1, helperMock.Object.PopulateItems()[1] } }; order.Order(1, 2, ref dict); Assert.AreNotEqual(dict, helperMock.Object.PopulateItems()); }
public void TestOrderItem() { VendingItem item = new VendingItem(1, "Coke", V, 5); var helperMock = new Mock <IHelper>(); helperMock.Setup(x => x.PopulateItems()).Returns(new Dictionary <int, VendingItem>() { { 1, item } }); BlOrders order = new BlOrders(); try { order.CheckAmount(7, helperMock.Object.PopulateItems()[1], 4); Assert.Fail(); } catch (Exception e) { Assert.AreEqual("Error ocured in ordering Amount not OK!", e.Message + " " + e.InnerException.Message); } }