public void WhenAddingStuntBehaviorToObject_ThenCanAddInterface() { object stunt = new TestStunt(); stunt.AddBehavior(new TestStuntBehavior()); Assert.Single(((IStunt)stunt).Behaviors); }
public void WhenAddingStuntBehavior_ThenCanAddLambda() { var stunt = new TestStunt(); stunt.AddBehavior((m, n) => null); Assert.Single(stunt.Behaviors); }
public void WhenAddingStuntBehaviorToObject_ThenCanAddLambda() { object stunt = new TestStunt(); stunt.AddBehavior((m, n) => null); Assert.Single(((IStunt)stunt).Behaviors); }
public void WhenAddingStuntBehaviorToObject_ThenCanAddLambdaWithAppliesTo() { object stunt = new TestStunt(); stunt.AddBehavior((m, n) => null, m => true); Assert.True(((IStunt)stunt).Behaviors[0].AppliesTo(null)); }
public void WhenAddingStuntBehavior_ThenCanAddLambdaWithAppliesTo() { var stunt = new TestStunt(); stunt.AddBehavior((m, n) => null, m => true); Assert.True(stunt.Behaviors[0].AppliesTo(null)); }
public void WhenAddingStuntBehavior_ThenCanAddInterface() { var stunt = new TestStunt(); stunt.AddBehavior(new TestStuntBehavior()); Assert.Single(stunt.Behaviors); }
public void WhenAddingStuntBehavior_ThenCanCustom() { IStunt stunt = new TestStunt(); stunt.AddBehavior(new TestStuntBehavior()); Assert.Single(stunt.Behaviors); }
public void WhenInsertingStuntBehavior_ThenCanAddLambda() { var stunt = new TestStunt(); stunt.AddBehavior((m, n) => null); stunt.InsertBehavior(0, (m, n) => throw new NotImplementedException()); Assert.Equal(2, stunt.Behaviors.Count); Assert.Throws <NotImplementedException>(() => stunt.Behaviors[0].Execute(null, null)); }
public void WhenInsertingStuntBehaviorToObject_ThenCanAddLambda() { object stunt = new TestStunt(); stunt.AddBehavior((m, n) => null); stunt.InsertBehavior(0, (m, n) => throw new NotImplementedException()); Assert.Equal(2, ((IStunt)stunt).Behaviors.Count); Assert.Throws <NotImplementedException>(() => ((IStunt)stunt).Behaviors[0].Invoke(null, null)); }
public void WhenAddingStuntBehaviorToObject_ThenCanAddLambdaWithAppliesToNamed() { object stunt = new TestStunt(); stunt.AddBehavior((m, n) => null, m => true, "true"); ((IStunt)stunt).AddBehavior((m, n) => null, m => false, "false"); Assert.Contains("true", ((IStunt)stunt).Behaviors[0].ToString()); Assert.Contains("false", ((IStunt)stunt).Behaviors[1].ToString()); }
public void WhenInsertingStuntBehavior_ThenCanCustom() { IStunt stunt = new TestStunt(); stunt.AddBehavior((m, n) => null); stunt.InsertBehavior(0, new TestStuntBehavior()); Assert.Equal(2, stunt.Behaviors.Count); Assert.IsType <TestStuntBehavior>(stunt.Behaviors[0]); }
public void WhenInsertingStuntBehavior_ThenCanAddInterface() { var stunt = new TestStunt(); var behavior = new TestStuntBehavior(); stunt.AddBehavior((m, n) => null); stunt.InsertBehavior(0, behavior); Assert.Equal(2, stunt.Behaviors.Count); Assert.Same(behavior, stunt.Behaviors[0]); }
public void WhenInsertingStuntBehaviorToObject_ThenCanAddLambdaWithAppliesToNamed() { object stunt = new TestStunt(); stunt.AddBehavior((m, n) => null); stunt.InsertBehavior(0, (m, n) => throw new NotImplementedException(), m => true, "true"); ((IStunt)stunt).InsertBehavior(0, (m, n) => throw new ArgumentException(), m => false, "false"); Assert.Equal(3, ((IStunt)stunt).Behaviors.Count); Assert.Contains("false", ((IStunt)stunt).Behaviors[0].ToString()); Assert.Contains("true", ((IStunt)stunt).Behaviors[1].ToString()); }
public void WhenInsertingStuntBehavior_ThenCanAddLambdaWithAppliesTo() { var stunt = new TestStunt(); stunt.AddBehavior((m, n) => null); stunt.InsertBehavior(0, (m, n) => throw new NotImplementedException(), m => true); stunt.InsertBehavior(0, (m, n) => throw new ArgumentException(), m => false); Assert.Equal(3, stunt.Behaviors.Count); Assert.False(stunt.Behaviors[0].AppliesTo(null)); Assert.True(stunt.Behaviors[1].AppliesTo(null)); Assert.Throws <NotImplementedException>(() => stunt.Behaviors[1].Execute(null, null)); }