public void Ex1() { string environment = "production"; ILoggable log; if (environment == "production") { log = new Logger(); } else { log = new FakeLogger(); } var x = new ClientX(); x.Run(log); var y = new ClientY(); y.Run(log); CollectionAssert.AreEqual(new[] { "New Logger", "ClientX", "Logger:1", "Logger:2", "ClientY", "Logger:3", "Logger:4", }, _actions); }
public static void Run(string environment) { IocContainer.Setup(environment); var x = new ClientX(); var y = new ClientY(); x.MethodA(); y.MethodB(); }
public void Ex1() { var x = new ClientX(); x.Run("production"); var y = new ClientY(); y.Run("production"); CollectionAssert.AreEqual(new[] { "Enter ClientX", "Logger:ClientX", "Enter ClientY", "Logger:ClientY", }, _actions); }
public static void Run(string environment) { ILoggable log; ICalculator calculator; if (environment == "production") { log = new Logger(); calculator = new Calculator(log); } else { log = new AlternativeLogger(); calculator = new AlternativeCalculator(log); } var x = new ClientX(calculator); var y = new ClientY(calculator); x.MethodA(); y.MethodB(); }
public void Ex1() { string environment = "production"; var x = new ClientX(); x.Run(environment); var y = new ClientY(); y.Run(environment); CollectionAssert.AreEqual(new[] { "New Logger", "ClientX", "Logger:1", "Logger:2", "ClientY", "Logger:3", "Logger:4", }, _actions); }