コード例 #1
0
        public void Compose_should_flatten_notifiers_and_return_NoProgressNotifier_if_no_specific_notifiers_are_present()
        {
            var result = DelegatingScenarioProgressNotifier.Compose(new IScenarioProgressNotifier[]
            {
                new DelegatingScenarioProgressNotifier(
                    NoProgressNotifier.Default,
                    NoProgressNotifier.Default,
                    new DelegatingScenarioProgressNotifier(),
                    new DelegatingScenarioProgressNotifier(NoProgressNotifier.Default)),
                NoProgressNotifier.Default,
                new DelegatingScenarioProgressNotifier()
            });

            Assert.That(result, Is.TypeOf <NoProgressNotifier>());
        }
コード例 #2
0
        public void Compose_should_flatten_notifiers_and_return_specific_one_if_only_one_is_present()
        {
            var specific = Mock.Of <IScenarioProgressNotifier>();
            var result   = DelegatingScenarioProgressNotifier.Compose(new IScenarioProgressNotifier[]
            {
                new DelegatingScenarioProgressNotifier(
                    NoProgressNotifier.Default,
                    NoProgressNotifier.Default,
                    new DelegatingScenarioProgressNotifier(),
                    new DelegatingScenarioProgressNotifier(NoProgressNotifier.Default, specific)),
                NoProgressNotifier.Default,
                new DelegatingScenarioProgressNotifier()
            });

            Assert.That(result, Is.SameAs(specific));
        }
コード例 #3
0
        public void Compose_should_flatten_notifiers()
        {
            var specific1 = Mock.Of <IScenarioProgressNotifier>();
            var specific2 = Mock.Of <IScenarioProgressNotifier>();
            var result    = DelegatingScenarioProgressNotifier.Compose(new[]
            {
                new DelegatingScenarioProgressNotifier(
                    NoProgressNotifier.Default,
                    NoProgressNotifier.Default,
                    new DelegatingScenarioProgressNotifier(),
                    new DelegatingScenarioProgressNotifier(NoProgressNotifier.Default, specific1)),
                NoProgressNotifier.Default,
                new DelegatingScenarioProgressNotifier(),
                specific2
            });

            Assert.That(result, Is.TypeOf <DelegatingScenarioProgressNotifier>());
            Assert.That(
                ((DelegatingScenarioProgressNotifier)result).Notifiers,
                Is.EqualTo(new[] { specific1, specific2 }));
        }
コード例 #4
0
 public void SetUp()
 {
     _notifiers = new[] { Mock.Of <IScenarioProgressNotifier>(), Mock.Of <IScenarioProgressNotifier>() };
     _subject   = new DelegatingScenarioProgressNotifier(_notifiers);
 }
コード例 #5
0
 public IScenarioProgressNotifier Compose(object fixture)
 {
     return(DelegatingScenarioProgressNotifier.Compose(_providers.Select(p => p.Provide(fixture))));
 }