public void Should_ReturnTrue_And_SetCondition_When_WithConditionCommand()
            {
                Predicate <object> condition = o => true;

                var context = Substitute.For <IScopeBuilderContext>();
                var command = new WithConditionCommand <TestClass>(condition);

                var builder = new RuleCommandScopeBuilder <TestClass>(new RuleCommand <TestClass>(x => true));

                var tryAddResult = builder.TryAdd(command);

                tryAddResult.Should().BeTrue();

                var builtScope = (ICommandScope <TestClass>)builder.Build(context);

                builtScope.ExecutionCondition.Should().BeSameAs(condition);
            }
Пример #2
0
            public void Should_ReturnTrue_And_SetExecutionCondition_When_WithConditionCommand()
            {
                Predicate <TestClass> predicate = o => true;

                var context = Substitute.For <IScopeBuilderContext>();
                var command = new WithConditionCommand <TestClass>(predicate);

                var builder = new CommandScopeBuilder <TestClass>(new TestCommand(), (cmd, ctx) => Substitute.For <ICommandScope <TestClass> >());

                var tryAddResult = builder.TryAdd(command);

                tryAddResult.Should().BeTrue();

                var builtScope = (ICommandScope <TestClass>)builder.Build(context);

                builtScope.ExecutionCondition.Should().BeSameAs(predicate);
            }