public void StrategyStagesRunInProperOrder() { Builder builder = new Builder(); StrategyChain strategies = new StrategyChain(); strategies.Add(new StringConcatStrategy("1")); strategies.Add(new StringConcatStrategy("2")); strategies.Add(new StringConcatStrategy("3")); strategies.Add(new StringConcatStrategy("4")); string s = builder.BuildUp <string>(null, null, null, strategies, null, null); Assert.Equal("1234", s); }
public void StrategiesRunInReverseOrder() { Builder builder = new Builder(); StrategyChain strategies = new StrategyChain(); strategies.Add(new StringConcatStrategy("1")); strategies.Add(new StringConcatStrategy("2")); strategies.Add(new StringConcatStrategy("3")); strategies.Add(new StringConcatStrategy("4")); string s = builder.TearDown(null, null, null, strategies, ""); Assert.Equal("4321", s); }
public void PoliciesSetDuringBuildUpDoNotPersistAfterBuildUpComplete() { Builder builder = new Builder(); PolicyList policies = new PolicyList(); StrategyChain strategies = new StrategyChain(); PolicySettingStrategy setStrategy = new PolicySettingStrategy(); PolicyGettingStrategy getStrategy = new PolicyGettingStrategy(); strategies.Add(setStrategy); strategies.Add(getStrategy); builder.BuildUp <object>(null, null, policies, strategies, null, null); Assert.Same(setStrategy.Policy, getStrategy.Policy); Assert.Null(policies.Get <FakePolicy>(typeof(object))); }