public void SaveHourCost_Update_EntityIsCommon()
        {
            var repo = CreateRepo(100, new HourCostEntity
            {
                Id        = 100,
                IsDeleted = false,
                Cost      = 250,
                Start     = 15,
                End       = 20,
                DayType   = DiscountDayTypeEnum.Weekend | DiscountDayTypeEnum.Workday,
                IsGeneral = false
            });
            var service = new HourCostManagerService(repo.Object);

            HourCostDto result = service.SaveHourCost(new HourCostUpdateDto
            {
                Id      = 100,
                Cost    = 100,
                Start   = 10,
                End     = 23,
                DayType = DiscountDayTypeEnum.Workday
            });

            repo.Verify(x => x.Save(It.IsAny <HourCostEntity>()));
            Assert.AreEqual(100, result.Id);
            Assert.AreEqual(100, result.Cost);
            Assert.AreEqual(DiscountDayTypeEnum.Workday, result.DayType);
            Assert.AreEqual(10, result.Start);
            Assert.AreEqual(23, result.End);
        }
        public void SaveHourCost_Update_NoEntity()
        {
            var repo    = CreateRepo(100, null);
            var service = new HourCostManagerService(repo.Object);

            HourCostDto result = service.SaveHourCost(new HourCostUpdateDto
            {
                Id = 100
            });
        }
        public void SaveHourCost_Update_EntityAlreadyDeleted()
        {
            var repo = CreateRepo(100, new HourCostEntity
            {
                IsDeleted = true
            });
            var service = new HourCostManagerService(repo.Object);

            HourCostDto result = service.SaveHourCost(new HourCostUpdateDto
            {
                Id = 100
            });
        }
        public void SaveHourCost_Insert()
        {
            var repo    = CreateRepo(0, null);
            var service = new HourCostManagerService(repo.Object);

            HourCostDto result = service.SaveHourCost(new HourCostUpdateDto
            {
                Id      = -1,
                Cost    = 250,
                DayType = DiscountDayTypeEnum.Weekend | DiscountDayTypeEnum.Workday,
                Start   = 10,
                End     = 20
            });

            repo.Verify(x => x.Save(It.IsAny <HourCostEntity>()));
            Assert.AreEqual(0, result.Id);
            Assert.AreEqual(250, result.Cost);
            Assert.AreEqual(DiscountDayTypeEnum.Weekend | DiscountDayTypeEnum.Workday, result.DayType);
            Assert.AreEqual(10, result.Start);
            Assert.AreEqual(20, result.End);
        }