public static void Main() { var context = new StrategyContext(new FirstStrategy()); context.Execute(); context.Strategy = new SecondStrategy(); context.Execute(); }
public void DoStuff() { var context = new StrategyContext(new Strategy0()); context.Execute(); context.SetStrategy(new Strategy1()); context.Execute(); }
public void ConcreteStrategyMultiplyTest() { //arrange var a = 8; var b = 3; var properResult = 24; IStrategy strategy = new Multiply(); StrategyContext context = new StrategyContext(strategy); //act var result = context.Execute(a, b); //assert Assert.AreEqual(properResult, result); }
public void ConcreteStrategySubtractTest() { //arrange var a = 128; var b = 64; var properResult = 64; IStrategy strategy = new Subtract(); StrategyContext context = new StrategyContext(strategy); //act var result = context.Execute(a, b); //assert Assert.AreEqual(properResult, result); }