public void GetOrderCost() { var obj = new DeliveryServiceModel() { BaseCost = 100, Distance = 30, Floor = 4, GoldRated = false, HasCoupen = false, NewCustomer = false, WeekendDelivery = false }; var returnObj = new DeliveryServiceModel() { BaseCost = 100, Distance = 30, Floor = 4, GoldRated = false, HasCoupen = false, NewCustomer = false, WeekendDelivery = false, id = 1, TotalCost = 125 }; this.deliveryServiceAdapter.Setup(x => x.Save(It.IsAny <DeliveryServiceModel>())).Returns(returnObj); var controller = new DeliveryController(deliveryServiceAdapter.Object); var output = controller.GetOrderCost(obj); this.deliveryServiceAdapter.VerifyAll(); Assert.IsNotNull(output); Assert.IsTrue(output.Equals(returnObj)); }
public void GetOrderCost_NullObject() { var returnObj = new DeliveryServiceModel() { BaseCost = 100, Distance = 30, Floor = 4, GoldRated = false, HasCoupen = false, NewCustomer = false, WeekendDelivery = false, id = 1, TotalCost = 200 }; this.deliveryServiceAdapter.Setup(x => x.Save(It.IsAny <DeliveryServiceModel>())).Returns(returnObj); var controller = new DeliveryController(deliveryServiceAdapter.Object); var output = controller.GetOrderCost(null); }