public void CanUse_ShouldReturnCorrectValue( [Modest] Actor sut, AbilityTest ability) { var expected = new[] { ability }; //act var actual = sut.CanUse(ability); //assert actual.Should().BeOfType <Actor>().Which.Abilities.Values.Should().Equal(expected); }
public void CanUse_WithLazyAbility_ShouldNotMaterializeValue( [Modest] Actor sut, AbilityTest ability) { var lazyAbility = new Lazy <AbilityTest>(() => ability); //act var actual = sut.CanUse(ability); //assert Assert.False(lazyAbility.IsValueCreated); }
public void CanUse_WhenActorHasAbilities_ShouldReturnCorrectValue( Actor sut, AbilityTest ability) { // var expected = sut.Abilities.Values.Concat(new[] { ability }).ToArray(); //act var actual = sut.CanUse(ability); //assert actual.Should().BeOfType <Actor>().Which.Abilities.Values.Should().Equal(expected); }
public void CanUse_WithLazyAbility_ExecutingWhen_WithOtherAbility_ShouldNotMaterializeValue( [Modest] Actor sut, AbilityTest ability, object otherAbility, IWhenCommand <object, Unit> whenCommand) { var lazyAbility = new Lazy <AbilityTest>(() => ability); var actual = sut.CanUse(ability).CanUse(otherAbility); //act actual.When(whenCommand); //assert Assert.False(lazyAbility.IsValueCreated); }
public void CanUse_WithLazyAbility_ExecutingAskFor_WithOtherAbility_ShouldNotMaterializeValue( [Modest] Actor sut, AbilityTest ability, object otherAbility, #pragma warning disable CS0618 // Type or member is obsolete IQuestion <object, Unit> question) #pragma warning restore CS0618 // Type or member is obsolete { var lazyAbility = new Lazy <AbilityTest>(() => ability); var actual = sut.CanUse(ability).CanUse(otherAbility); //act actual.AsksFor(question); //assert Assert.False(lazyAbility.IsValueCreated); }