public void ConfigureAttack_LoadsUpAttackAbilityForConfiguration() { AbilityEditorViewModel viewModel = AbilityEditorViewModelUnderTest; var attack = TestObjectsFactory.MockAttack; attack.Owner = TestObjectsFactory.MockAnimatedCharacter; attack.Name = "Attack"; Mock.Get(attack.Owner as AnimatedCharacter).SetupGet(x => x.Abilities["Attack"]).Returns(attack); var onHitAbility = TestObjectsFactory.MockAnimatedAbility; onHitAbility.Owner = attack.Owner; onHitAbility.Name = "Attack - OnHit"; attack.OnHitAnimation = onHitAbility; viewModel.CurrentAbility = onHitAbility; (viewModel as AbilityEditorViewModelImpl).IsConfiguringOnHit = true; viewModel.ConfigureAttack(); Assert.AreEqual(viewModel.CurrentAbility, attack); }
public void UpdateReferenceTypeToCopyForReferenceElement_RemovesReferenceAndAddsTheSequenceResultingFromReferenceCopy() { AbilityEditorViewModel viewModel = AbilityEditorViewModelUnderTest; var ability = TestObjectsFactory.MockAnimatedAbility; viewModel.CurrentAbility = ability; var mockRefElement = TestObjectsFactory.MockReferenceElement; var mockSeqElement = TestObjectsFactory.MockSequenceElement; var selected = TestObjectsFactory.MockAnimationElement; viewModel.SelectedAnimationElement = mockRefElement; Mock.Get(mockRefElement).Setup(x => x.Copy(It.IsAny <AnimatedCharacter>())).Returns(mockSeqElement); (viewModel as AbilityEditorViewModelImpl).CopyReference = true; (viewModel as AbilityEditorViewModelImpl).CurrentReferenceElement = mockRefElement; viewModel.UpdateReferenceTypeForReferenceElement(); Mock.Get(mockRefElement).Verify(x => x.Copy(ability.Target)); Mock.Get(ability).Verify(x => x.RemoveElement(mockRefElement)); Mock.Get <AnimationSequencer>(ability).Verify(x => x.InsertElementAfter(mockSeqElement, It.IsAny <AnimationElement>())); }