예제 #1
0
            public static ISpecificationPrimitive Context(string message, ContextDelegate arrange)
            {
                EnsureThreadStaticInitialized();

                if (_context == null)
                {
                    _context = new SpecificationPrimitive <ContextDelegate>(message, arrange);
                }
                else
                {
                    _exceptions.Add(() => { throw new InvalidOperationException("Cannot have more than one Context statement in a specification"); });
                }

                return(_context);
            }
예제 #2
0
        public ContextCondition(Condition sub, ContextDelegate initialize, ContextDelegate finalize)
        {
            if (sub == null)
            {
                throw new ArgumentNullException(nameof(sub));
            }
            if (initialize == null)
            {
                throw new ArgumentNullException(nameof(initialize));
            }
            if (finalize == null)
            {
                throw new ArgumentNullException(nameof(finalize));
            }

            this.Sub        = sub;
            this.Initialize = initialize;
            this.Finalize   = finalize;
        }
 public abstract FSharpOption <JsonValue> Invoke(ContextDelegate contextDelegate);
예제 #4
0
 /// <summary>
 /// Records a disposable context for this specification. The context lifecycle will be managed by SubSpec.
 /// </summary>
 /// <param name="message">A message describing the established context.</param>
 /// <param name="arrange">The action that will establish and return the context for this test.</param>
 public static ISpecificationPrimitive ContextFixture(this string message, ContextDelegate arrange)
 {
     return(SubSpec.Core.SpecificationContext.Context(message, arrange));
 }
예제 #5
0
 public static void Context(this string message, ContextDelegate arrange)
 {
     throw new InvalidOperationException(IDisposableHintMessaage);
 }