public void HealCitizen_simple_test() { var hospital = new HospitalDummyCreator().Create(); var citizen = new CitizenDummyCreator().Create(); var healingPrice = new HealingPrice() { Cost = 12.34m, CurrencyID = 1 }; hospitalRepository.Setup(x => x.GetHealingPrice(It.IsAny <int>(), It.IsAny <int>())).Returns(healingPrice); transactionsService.Setup(x => x.PayForHealing(It.IsAny <Hospital>(), It.IsAny <Citizen>(), It.IsAny <HealingPrice>())); equipmentService.Setup(x => x.RemoveProductsFromEquipment(It.IsAny <ProductTypeEnum>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <Equipment>())); hospitalService.HealCitizen(citizen, hospital); transactionsService.Verify(x => x.PayForHealing( It.Is <Hospital>(h => h == hospital), It.Is <Citizen>(c => c == citizen), It.Is <HealingPrice>(h => h == healingPrice)), Times.Once); equipmentService.Verify(e => e.RemoveProductsFromEquipment( It.Is <ProductTypeEnum>(t => t == ProductTypeEnum.MedicalSupplies), It.Is <int>(amount => amount == 1), It.Is <int>(quality => quality == hospital.Company.Quality), It.Is <Equipment>(eq => eq == hospital.Company.Entity.Equipment)), Times.Once); }
public void HealCitizen_freeHealing_test() { var hospital = new HospitalDummyCreator().Create(); var citizen = new CitizenDummyCreator().Create(); var healingPrice = new HealingPrice() { Cost = null, CurrencyID = 1 }; hospitalRepository.Setup(x => x.GetHealingPrice(It.IsAny <int>(), It.IsAny <int>())).Returns(healingPrice); hospitalService.HealCitizen(citizen, hospital); transactionsService.Verify(x => x.PayForHealing( It.IsAny <Hospital>(), It.IsAny <Citizen>(), It.IsAny <HealingPrice>()), Times.Never); }
public void PayForHealing_simple_test() { var hospital = new HospitalDummyCreator().Create(); var citizen = new CitizenDummyCreator().Create(); var currency = new CurrencyDummyCreator().Create(); var healingPrice = new HealingPrice() { CurrencyID = currency.ID, Cost = 12.34m }; transactionsService.PayForHealing(hospital, citizen, healingPrice); mockTransactionsService.Verify(x => x.MakeTransaction(It.Is <Transaction>( t => t.TransactionType == TransactionTypeEnum.Healing && t.DestinationEntityID == hospital.CompanyID && t.SourceEntityID == citizen.ID && t.Money.Currency == currency && t.Money.Amount == healingPrice.Cost ), It.IsAny <bool>())); }