public void IfCraftingStepTrueConditionTest() { Mock <ICraftingStep> mockChildStep = new Mock <ICraftingStep>(); List <ICraftingStep> craftingSteps = new List <ICraftingStep>(); IfCraftingStep ifStep = new IfCraftingStep(); ifStep.Children.Add(mockChildStep.Object); ifStep.Condition = GetTestCondition(); craftingSteps.Add(ifStep); EndCraftingStep endCrafting = new EndCraftingStep(); craftingSteps.Add(endCrafting); Equipment equipment = GetTestEquipment(true); AffixManager affixManager = CreateAffixManager(equipment.ItemBase); CancellationToken token = new CancellationToken(false); mockChildStep.Setup(x => x.ShouldVisitChildren(It.IsAny <Equipment>(), It.IsAny <int>())).Returns(false); mockChildStep.Setup(x => x.Craft(It.IsAny <Equipment>(), It.IsAny <AffixManager>())) .Returns(new Dictionary <string, int>()); _craftManager.Craft(craftingSteps, equipment, affixManager, token, _progressManager); mockChildStep.Verify(x => x.Craft(It.IsAny <Equipment>(), It.IsAny <AffixManager>()), Times.Once); Assert.IsTrue(equipment.Completed); }
public void IfCraftingStepDoesNotCombineCompletedStatusTest() { List <ICraftingStep> craftingSteps = new List <ICraftingStep>(); IfCraftingStep ifStep = new IfCraftingStep(); craftingSteps.Add(ifStep); AddOrb(ifStep.Children, new AlchemyOrb(_random.Object)); AddStep(ifStep.Children, new EndCraftingStep()); StatusMetadata metadata = _statusManager.Evaluate(craftingSteps); Assert.IsTrue(metadata.CurrentStatus.Rarity == EquipmentRarity.Normal); }
public void IfCraftingStepCombinesStatusOnceTest() { List <ICraftingStep> craftingSteps = new List <ICraftingStep>(); IfCraftingStep ifStep = new IfCraftingStep(); craftingSteps.Add(ifStep); AddOrb(ifStep.Children, new RegalOrb(_random.Object)); AddOrb(ifStep.Children, new TransmutationOrb(_random.Object)); StatusMetadata metadata = _statusManager.Evaluate(craftingSteps); Assert.IsTrue(metadata.CurrentStatus.Rarity == (EquipmentRarity.Normal | EquipmentRarity.Magic)); }