/// <summary>
        /// Instantiates a new PreconditionSpecTests object.
        /// </summary>
        /// <param name="fixture"></param>
        public PreconditionSpecTests(SpecFactoryFixture fixture)
        {
            if (fixture == null)
            {
                throw new ArgumentNullException(nameof(fixture));
            }

            SpecFactory = fixture.SpecFactory;

            // Returns a mocked BehaviourSpec
            SpecFactory.CreateBehaviourSpec(null).ReturnsForAnyArgs(fixture.BehaviourSpec);
        }
Beispiel #2
0
        public BehaviourSpec(Action precondition, ISpecFactory <TSubject> specFactory)
        {
            if (precondition == null)
            {
                throw new ArgumentNullException(nameof(precondition));
            }
            if (specFactory == null)
            {
                throw new ArgumentNullException(nameof(specFactory));
            }

            Precondition = precondition;
            SpecFactory  = specFactory;
        }
Beispiel #3
0
        public PreconditionSpec(string scenario, ISpecFactory <TSubject> specFactory)
        {
            if (string.IsNullOrWhiteSpace(scenario))
            {
                throw new ArgumentException($"String cannot be empty.", nameof(scenario));
            }
            if (specFactory == null)
            {
                throw new ArgumentNullException(nameof(specFactory));
            }

            Scenario    = scenario;
            SpecFactory = specFactory;
        }
Beispiel #4
0
        public AssertionSpec(Action precondition, Action <TSubject> behaviourSpec, ISpecFactory <TSubject> specFactory)
        {
            if (precondition == null)
            {
                throw new ArgumentNullException(nameof(precondition));
            }
            if (behaviourSpec == null)
            {
                throw new ArgumentNullException(nameof(behaviourSpec));
            }
            if (specFactory == null)
            {
                throw new ArgumentNullException(nameof(specFactory));
            }

            Precondition  = precondition;
            BehaviourSpec = behaviourSpec;
            SpecFactory   = specFactory;
        }
Beispiel #5
0
        public AssertionSpec(Func <TData> precondition, Action <TSubject, TData> behaviour, ISpecFactory <TSubject> specFactory)
        {
            if (precondition == null)
            {
                throw new ArgumentNullException(nameof(precondition));
            }
            if (behaviour == null)
            {
                throw new ArgumentNullException(nameof(behaviour));
            }
            if (specFactory == null)
            {
                throw new ArgumentNullException(nameof(specFactory));
            }

            Precondition = precondition;
            Behaviour    = behaviour;
            SpecFactory  = specFactory;
        }