Beispiel #1
0
        public void GetCostReturnusingServiceMock()
        {
            Mock <ICostService> mockCostService = new Mock <ICostService>();

            mockCostService.Setup(x => x.GetBenefitCost(It.IsAny <Employee>())).Returns(5000);
            var costController = new CostController(mockCostService.Object);

            var retcost = costController.GetCost(new Employee());

            Assert.AreEqual(retcost, 5000);
        }
Beispiel #2
0
        public void GetCostReturnsStatic()
        {
            ICostService costService    = new CostService();
            var          costController = new CostController(costService);
            Employee     emp            = new Employee()
            {
                FirstName = "Kalyani", LastName = "Sundaresan"
            };
            var retcost = costController.GetCost(emp);

            Assert.AreEqual(retcost, 1000);
        }