Example #1
0
        /// <summary>
        /// Construct given a base constraint
        /// </summary>
        /// <param name="baseConstraint"></param>
        protected PrefixConstraint(IResolveConstraint baseConstraint)
            : base(baseConstraint)
        {
            Guard.ArgumentNotNull(baseConstraint, "baseConstraint");

            this.baseConstraint = baseConstraint.Resolve();
        }
		public static void WithHeader(this RequestHandler handler, string header, IResolveConstraint match)
		{
			string headerValue;
			handler.LastRequest().RequestHead.Headers.TryGetValue(header, out headerValue);
			Assert.That(headerValue, Is.Not.Null, "Request did not contain a header '{0}'", header);
			Assert.That(headerValue, match);
		}
 public static void That(object actual, IResolveConstraint expected, string message, bool @continue = true)
 {
     try
     {
         Assert.That(actual, expected, message);
     }
     catch (AssertionException ae)
     {
         TestFailure.HandleAssertionException(ae, @continue);
     }
 }
Example #4
0
 public static void That(object actual, IResolveConstraint expression, string message)
 {
     try
     {
         Assert.That(actual, expression, message);
     }
     catch (Exception ex)
     {
         throw new FailedToReachEnlightenmentException(ex.Message);
     }
 }
Example #5
0
        private static void Test(Func<IQueryable<Order>, IQueryable<OrderPosition>, IQueryable<long>> func, IResolveConstraint expected)
        {
            using (var source1 = CreateOrdersDbConnection())
            using (var source2 = CreateOrderPositionsDbConnection())
            {
                var orders = source1.GetTable<Order>().Where(x => x.Id < 1000);
                var positions = source2.GetTable<OrderPosition>().Where(x => x.OrderId < 2000);
                var join = func.Invoke(orders, positions);

                Assert.That(() => join.ToArray(), expected);
            }
        }
Example #6
0
        public void AssertServiceMessage(string name, IResolveConstraint resolveConstraint = null, Dictionary<string, object> properties = null, string message = "", params object[] args)
        {

            switch (name)
            {
                case ServiceMessageNames.CalamariFoundPackage.Name:
                    Assert.That(captured.CalamariFoundPackage, resolveConstraint, message, args);
                    break;
                case ServiceMessageNames.FoundPackage.Name:
                    Assert.That(captured.FoundPackage, Is.Not.Null);
                    if (properties != null)
                    {
                        Assert.That(resolveConstraint, Is.Not.Null, "Resolve constraint was not provided");
                        foreach (var property in properties)
                        {
                            var fp = JObject.FromObject(captured.FoundPackage);
                            string value;
                            if (property.Key.Contains("."))
                            {
                                var props = property.Key.Split(new[] {'.'}, StringSplitOptions.RemoveEmptyEntries);
                                value = fp[props[0]][props[1]].ToString();
                            }
                            else
                            {
                                value = fp[property.Key].ToString();
                            }
                            AssertServiceMessageValue(property.Key, property.Value, value, resolveConstraint);
                        }
                    }
                    break;
                case ServiceMessageNames.PackageDeltaVerification.Name:
                    Assert.That(captured.DeltaVerification, Is.Not.Null);
                    if (properties != null)
                    {
                        foreach (var property in properties)
                        {
                            var dv = JObject.FromObject(captured.DeltaVerification);
                            string value;
                            if (property.Key.Contains("."))
                            {
                                var props = property.Key.Split(new[] {'.'}, StringSplitOptions.RemoveEmptyEntries);
                                value = dv[props[0]][props[1]].ToString();
                            }
                            else
                            {
                                value = dv[property.Key].ToString();
                            }
                            AssertServiceMessageValue(property.Key, property.Value, value, resolveConstraint);
                        }
                    }
                    break;
            }
        }
Example #7
0
 /// <summary>
 ///     Apply a constraint to a referenced boolean, succeeding if the constraint
 ///     is satisfied and throwing an assertion exception on failure.
 /// </summary>
 /// <param name="actual">The actual value to test</param>
 /// <param name="constraint">A Constraint to be applied</param>
 internal static void That(ref bool actual, IResolveConstraint constraint)
 {
     That(ref actual, constraint.Resolve(), null, null);
 }
Example #8
0
 /// <summary>
 ///     Apply a constraint to an actual value, succeeding if the constraint
 ///     is satisfied and throwing an assertion exception on failure.
 ///     Used as a synonym for That in rare cases where a private setter
 ///     causes a Visual Basic compilation error.
 /// </summary>
 /// <param name="stepName">The Step Name to Allure report</param>
 /// <param name="actual">The actual value to test</param>
 /// <param name="expression">A Constraint to be applied</param>
 public bool ByVal(string stepName, object actual, IResolveConstraint expression, params object[] stepParams)
 {
     return(VerifyRunner(stepName, () => Assert.That(actual, expression, null, null), Status.failed, stepParams));
 }
Example #9
0
 /// <summary>
 /// Apply a constraint to a referenced value, succeeding if the constraint
 /// is satisfied and throwing an InconclusiveException on failure.
 /// </summary>
 /// <param name="constraint">A Constraint to be applied</param>
 /// <param name="actual">The actual value to test</param>
 /// <param name="message">The message that will be displayed on failure</param>
 static public void That(ref bool actual, IResolveConstraint constraint, string message)
 {
     Assume.That(ref actual, constraint.Resolve(), message, null);
 }
 static void AssertServiceMessageValue(string property, object expected, string actual, IResolveConstraint resolveConstraint)
 {
     Assert.That(actual, Is.Not.Null);
     Assert.That(actual, Is.Not.Empty);
     Assert.That(actual.Equals(expected), resolveConstraint,
         "Expected property '{0}' to have value '{1}' but was actually '{2}'", property,
         expected, actual);
 }
Example #11
0
        /// <summary>
        /// Apply a constraint to an actual value, succeeding if the constraint
        /// is satisfied and throwing an assertion exception on failure.
        /// </summary>
        /// <param name="expression">A Constraint to be applied</param>
        /// <param name="actual">The actual value to test</param>
        /// <param name="message">The message that will be displayed on failure</param>
        /// <param name="args">Arguments to be used in formatting the message</param>
        static public void That(object actual, IResolveConstraint expression, string message, params object[] args)
        {
            Constraint constraint = expression.Resolve();

            Assert.IncrementAssertCount();
            if (!constraint.Matches(actual))
            {
                MessageWriter writer = new TextMessageWriter(message, args);
                constraint.WriteMessageTo(writer);
                throw new AssertionException(writer.ToString());
            }
        }
Example #12
0
 /// <summary>
 /// Apply a constraint to an actual value, succeeding if the constraint
 /// is satisfied and throwing an InconclusiveException on failure.
 /// </summary>
 /// <param name="expression">A Constraint expression to be applied</param>
 /// <param name="actual">The actual value to test</param>
 static public void That(object actual, IResolveConstraint expression)
 {
     Assume.That(actual, expression, null, null);
 }
 public static void Should(this TestDelegate invocation, IResolveConstraint constraint, string message)
 {
     Assert.That(invocation, constraint, message);
 }
Example #14
0
 /// <summary>
 /// Apply a constraint to an actual value, succeeding if the constraint
 /// is satisfied and throwing an assertion exception on failure.
 /// </summary>
 /// <param name="expr">A Constraint expression to be applied</param>
 /// <param name="del">An ActualValueDelegate returning the value to be tested</param>
 public void Expect(ActualValueDelegate del, IResolveConstraint expr)
 {
     Assert.That(del, expr.Resolve(), null, null);
 }
Example #15
0
 /// <summary>
 /// Apply a constraint to a referenced value, succeeding if the constraint
 /// is satisfied and throwing an assertion exception on failure.
 /// </summary>
 /// <param name="constraint">A Constraint to be applied</param>
 /// <param name="actual">The actual value to test</param>
 /// <param name="message">The message that will be displayed on failure</param>
 public void Expect(ref bool actual, IResolveConstraint constraint, string message)
 {
     Assert.That(ref actual, constraint.Resolve(), message, null);
 }
Example #16
0
 /// <summary>
 /// Apply a constraint to a referenced boolean, succeeding if the constraint
 /// is satisfied and throwing an assertion exception on failure.
 /// </summary>
 /// <param name="constraint">A Constraint to be applied</param>
 /// <param name="actual">The actual value to test</param>
 public void Expect(ref bool actual, IResolveConstraint constraint)
 {
     Assert.That(ref actual, constraint.Resolve(), null, null);
 }
Example #17
0
 public static async Task <Exception> ThrowsAsync(IResolveConstraint expression, AsyncTestDelegate code)
 {
     return(await ThrowsAsync(expression, code, string.Empty, null));
 }
Example #18
0
 public static void If <T>(ActualValueDelegate <T> actual, IResolveConstraint constraint)
 {
     constraint.Resolve().ApplyTo(actual);
 }
Example #19
0
 /// <summary>
 /// Applies an <see cref="IResolveConstraint"/> that, <b>if satisfied</b>, will throw an <see cref="IgnoreException"/>.
 /// </summary>
 /// <remarks>
 /// This is the more idiomatic use of the word "ignore", but actually inverts (i.e. <see cref="NotConstraint"/>)
 /// the provided <paramref name="constraint"/>.
 /// </remarks>
 /// <param name="actual">the actual <typeparamref name="T"/> value</param>
 /// <param name="constraint">the <see cref="IResolveConstraint"/> applied to <paramref name="actual"/></param>
 /// <typeparam name="T">the type of <paramref name="actual"/></typeparam>
 public static void If <T>(T actual, IResolveConstraint constraint)
 {
     Unless(actual, new NotConstraint(constraint.Resolve()));
 }
 public void GetDownloadLink_InvalidNode_Throws(INode node, IResolveConstraint constraint)
 {
     Assert.That(
         () => this.Client.GetDownloadLink(node),
         constraint);
 }
 public static Transmission AddPositionConstraint(this Transmission transmission, IResolveConstraint constraint) {
     return transmission.AddPropertyContraint(new ReusableConstraint(constraint), Utils.NameOf(() => transmission.Position));
 }
Example #22
0
 /// <summary>
 /// Apply a constraint to an actual value, succeeding if the constraint
 /// is satisfied and throwing an assertion exception on failure.
 /// </summary>
 /// <param name="expr">A Constraint expression to be applied</param>
 /// <param name="del">An ActualValueDelegate returning the value to be tested</param>
 /// <param name="message">The message that will be displayed on failure</param>
 public void Expect(ActualValueDelegate del, IResolveConstraint expr, string message)
 {
     Assert.That(del, expr.Resolve(), message, null);
 }
Example #23
0
 public static void That(object actual, IResolveConstraint expression)
 {
     That(actual, expression, string.Empty);
 }
Example #24
0
 /// <summary>
 /// Apply a constraint to an actual value, succeeding if the constraint
 /// is satisfied and throwing an assertion exception on failure.
 /// </summary>
 /// <param name="del">An ActualValueDelegate returning the value to be tested</param>
 /// <param name="expr">A Constraint expression to be applied</param>
 /// <param name="message">The message that will be displayed on failure</param>
 /// <param name="args">Arguments to be used in formatting the message</param>
 public void Expect(ActualValueDelegate del, IResolveConstraint expr, string message, params object[] args)
 {
     Assert.That(del, expr, message, args);
 }
Example #25
0
 /// <summary>
 /// Apply a constraint to an actual value, succeeding if the constraint
 /// is satisfied and throwing an assertion exception on failure.
 /// </summary>
 /// <param name="expression">A Constraint to be applied</param>
 /// <param name="actual">The actual value to test</param>
 static public void That(object actual, IResolveConstraint expression)
 {
     Assert.That(actual, expression, null, null);
 }
Example #26
0
 /// <summary>
 /// Apply a constraint to a referenced value, succeeding if the constraint
 /// is satisfied and throwing an assertion exception on failure.
 /// </summary>
 /// <param name="actual">The actual value to test</param>
 /// <param name="expression">A Constraint to be applied</param>
 public void Expect <T>(ref T actual, IResolveConstraint expression)
 {
     Assert.That(ref actual, expression, null, null);
 }
Example #27
0
 private void Then_error(IResolveConstraint matchesThis)
 {
     Assert.That(_result.Error.Trim(), matchesThis);
 }
Example #28
0
 /// <summary>
 /// Apply a constraint to a referenced value, succeeding if the constraint
 /// is satisfied and throwing an assertion exception on failure.
 /// </summary>
 /// <param name="actual">The actual value to test</param>
 /// <param name="expression">A Constraint to be applied</param>
 /// <param name="message">The message that will be displayed on failure</param>
 public void Expect <T>(ref T actual, IResolveConstraint expression, string message)
 {
     Assert.That(ref actual, expression, message, null);
 }
		public static void WithBody(this RequestHandler handler, IResolveConstraint constraint)
		{
			Assert.That(handler.GetBody(), constraint.Resolve());
		}
Example #30
0
 /// <summary>
 /// Asserts that the code represented by a delegate throws an exception
 /// that satisfies the constraint provided.
 /// </summary>
 /// <param name="code">A TestDelegate to be executed</param>
 /// <param name="constraint">A ThrowsConstraint used in the test</param>
 public void Expect(TestDelegate code, IResolveConstraint constraint)
 {
     Assert.That((object)code, constraint);
 }
Example #31
0
 /// <summary>
 ///     Asserts that the code represented by a delegate throws an exception
 ///     that satisfies the constraint provided.
 /// </summary>
 /// <param name="stepName">The Step Name to Allure report</param>
 /// <param name="code">A TestDelegate to be executed</param>
 /// <param name="constraint">A ThrowsConstraint used in the test</param>
 /// <param name="getExceptionMessage">A function to build the message included with the Exception</param>
 public bool That(string stepName, TestDelegate code, IResolveConstraint constraint,
                  Func <string> getExceptionMessage, params object[] stepParams)
 {
     return(VerifyRunner(stepName, () => Assert.That((object)code, constraint, getExceptionMessage),
                         Status.failed, stepParams));
 }
Example #32
0
        //private Assertions assert = new Assertions();
        //public virtual Assertions Assert
        //{
        //    get { return assert; }
        //}
        #endregion

        #region Expect

        #region Object

        /// <summary>
        /// Apply a constraint to an actual value, succeeding if the constraint
        /// is satisfied and throwing an assertion exception on failure. Works
        /// identically to Assert.That.
        /// </summary>
        /// <param name="actual">The actual value to test</param>
        /// <param name="expression">A Constraint to be applied</param>
        public void Expect(object actual, IResolveConstraint expression)
        {
            Assert.That(actual, expression, null, null);
        }
Example #33
0
 /// <summary>
 ///     Apply a constraint to an actual value, succeeding if the constraint
 ///     is satisfied and throwing an assertion exception on failure.
 ///     Used as a synonym for That in rare cases where a private setter
 ///     causes a Visual Basic compilation error.
 /// </summary>
 /// <remarks>
 ///     This method is provided for use by VB developers needing to test
 ///     the value of properties with private setters.
 /// </remarks>
 /// <param name="stepName">The Step Name to Allure report</param>
 /// <param name="actual">The actual value to test</param>
 /// <param name="expression">A Constraint expression to be applied</param>
 /// <param name="message">The message that will be displayed on failure</param>
 /// <param name="args">Arguments to be used in formatting the message</param>
 public bool ByVal(string stepName, object actual, IResolveConstraint expression, string message,
                   params object[] args)
 {
     return(VerifyRunner(stepName, () => Assert.That(actual, expression, message, args), Status.failed));
 }
Example #34
0
 /// <summary>
 /// Apply a constraint to an actual value, succeeding if the constraint
 /// is satisfied and throwing an assertion exception on failure. Works
 /// identically to Assert.That.
 /// </summary>
 /// <param name="actual">The actual value to test</param>
 /// <param name="expression">A Constraint to be applied</param>
 /// <param name="message">The message to be displayed in case of failure</param>
 public void Expect(object actual, IResolveConstraint expression, string message)
 {
     Assert.That(actual, expression, message, null);
 }
Example #35
0
 /// <summary>
 /// Construct a ReusableConstraint
 /// </summary>
 /// <param name="c">The constraint or expression to be reused</param>
 public ReusableConstraint(IResolveConstraint c)
 {
     this.constraint = c.Resolve();
 }
Example #36
0
 /// <summary>
 /// Apply a constraint to an actual value, succeeding if the constraint
 /// is satisfied and throwing an assertion exception on failure. Works
 /// identically to Assert.That.
 /// </summary>
 /// <param name="actual">The actual value to test</param>
 /// <param name="expression">A Constraint to be applied</param>
 /// <param name="message">The message to be displayed in case of failure</param>
 /// <param name="args">Arguments to use in formatting the message</param>
 public void Expect(object actual, IResolveConstraint expression, string message, params object[] args)
 {
     Assert.That(actual, expression, message, args);
 }
Example #37
0
        /// <summary>
        /// This operator creates a constraint that is satisfied if the
        /// argument constraint is not satisfied.
        /// </summary>
        public static Constraint operator !(Constraint constraint)
        {
            IResolveConstraint r = (IResolveConstraint)constraint;

            return(new NotConstraint(r.Resolve()));
        }
Example #38
0
        public async Task SetSecretWithExtendedProps()
        {
            string             secretName = Recording.GenerateId();
            IResolveConstraint createdUpdatedConstraint = Is.EqualTo(DateTimeOffset.FromUnixTimeSeconds(1565114301));

            KeyVaultSecret setResult = null;

            try
            {
                var            exp = new DateTimeOffset(new DateTime(637027248120000000, DateTimeKind.Utc));
                DateTimeOffset nbf = exp.AddDays(-30);

                var secret = new KeyVaultSecret(secretName, "CrudWithExtendedPropsValue1")
                {
                    Properties =
                    {
                        ContentType = "password",
                        NotBefore   = nbf,
                        ExpiresOn   = exp,
                        Tags        =
                        {
                            { "tag1", "value1" },
                            { "tag2", "value2" }
                        },
                    },
                };

                setResult = await Client.SetSecretAsync(secret);

                if (Mode != RecordedTestMode.Playback)
                {
                    DateTimeOffset now = DateTimeOffset.UtcNow;
                    createdUpdatedConstraint = Is.InRange(now.AddMinutes(-5), now.AddMinutes(5));
                }

                RegisterForCleanup(secret.Name, delete: false);

                Assert.IsNotEmpty(setResult.Properties.Version);
                Assert.AreEqual("password", setResult.Properties.ContentType);
                Assert.AreEqual(nbf, setResult.Properties.NotBefore);
                Assert.AreEqual(exp, setResult.Properties.ExpiresOn);
                Assert.AreEqual(2, setResult.Properties.Tags.Count);
                Assert.AreEqual("value1", setResult.Properties.Tags["tag1"]);
                Assert.AreEqual("value2", setResult.Properties.Tags["tag2"]);
                Assert.AreEqual(secretName, setResult.Name);
                Assert.AreEqual("CrudWithExtendedPropsValue1", setResult.Value);
                Assert.AreEqual(VaultUri, setResult.Properties.VaultUri);
                Assert.AreEqual("Recoverable+Purgeable", setResult.Properties.RecoveryLevel);
                Assert.That(setResult.Properties.CreatedOn, createdUpdatedConstraint);
                Assert.That(setResult.Properties.UpdatedOn, createdUpdatedConstraint);

                KeyVaultSecret getResult = await Client.GetSecretAsync(secretName);

                AssertSecretsEqual(setResult, getResult);
            }
            finally
            {
                DeleteSecretOperation deleteOperation = await Client.StartDeleteSecretAsync(secretName);

                DeletedSecret deleteResult = deleteOperation.Value;

                AssertSecretPropertiesEqual(setResult.Properties, deleteResult.Properties);
            }
        }
 public static void Should(this object actual, IResolveConstraint constraint, string message)
 {
     Assert.That(actual, constraint, message);
 }
 public void Move_InvalidParameters_Throws(INode node, INode destinationParentNode, IResolveConstraint constraint)
 {
     Assert.That(
         () => this.Client.Move(node, destinationParentNode),
         constraint);
 }
 public static void Should(this object actual, IResolveConstraint constraint)
 {
     Assert.That(actual, constraint);
 }
 public void OnGridTest(Cell otherCell, IResolveConstraint expectation)
 {
     var cell = new Cell(3, 4, true);
     Assert.That(cell.IsNextTo(otherCell), expectation);
 }
Example #43
0
 /// <summary>
 /// Returns the constraint provided as an argument - used to allow custom
 /// custom constraints to easily participate in the syntax.
 /// </summary>
 public Constraint Matches(IResolveConstraint constraint)
 {
     return(this.Append((Constraint)constraint.Resolve()));
 }
Example #44
0
 /// <summary>
 /// Asserts that the code represented by a delegate throws an exception
 /// that satisfies the constraint provided.
 /// </summary>
 /// <param name="code">A TestDelegate to be executed</param>
 /// <param name="constraint">A ThrowsConstraint used in the test</param>
 static public void That(TestDelegate code, IResolveConstraint constraint)
 {
     Assume.That((object)code, constraint);
 }
 public void CreateFolder_InvalidParameters_Throws(string name, INode parentNode, IResolveConstraint constraint)
 {
     Assert.That(
         () => this.Client.CreateFolder(name, parentNode),
         constraint);
 }
Example #46
0
 /// <summary>
 /// Verifies that a delegate throws a particular exception when called.
 /// </summary>
 /// <param name="expression">A constraint to be satisfied by the exception</param>
 /// <param name="code">A TestSnippet delegate</param>
 public static Exception Throws(IResolveConstraint expression, TestDelegate code)
 {
     return(Throws(expression, code, string.Empty, null));
 }
Example #47
0
 public static void Should(this object actual, IResolveConstraint expression)
 {
     Assert.That(actual, expression);
 }
Example #48
0
        /// <summary>
        /// This operator creates a constraint that is satisfied if the
        /// argument constraint is not satisfied.
        /// </summary>
        public static Constraint operator !(Constraint constraint)
        {
            IResolveConstraint r = constraint as IResolveConstraint;

            return(new NotConstraint(r == null ? new NullConstraint() : r.Resolve()));
        }
Example #49
0
 /// <summary>
 /// Apply a constraint to an actual value, succeeding if the constraint
 /// is satisfied and throwing an assertion exception on failure.
 /// </summary>
 /// <param name="expression">A Constraint to be applied</param>
 /// <param name="actual">The actual value to test</param>
 /// <param name="message">The message that will be displayed on failure</param>
 static public void That(object actual, IResolveConstraint expression, string message)
 {
     Assert.That(actual, expression, message, null);
 }
 public NodeForTypeConstraint(Type type, IResolveConstraint constraint)
 {
     this.type = type;
     this.constraint = constraint.Resolve();
 }
Example #51
0
 /// <summary>
 /// Construct a ReusableConstraint from a constraint expression
 /// </summary>
 /// <param name="c">The expression to be resolved and reused</param>
 public ReusableConstraint(IResolveConstraint c)
 {
     this.constraint = c.Resolve();
 }
Example #52
0
 /// <summary>
 ///     Apply a constraint to an actual value, succeeding if the constraint
 ///     is satisfied and throwing an assertion exception on failure.
 /// </summary>
 /// <param name="stepName">The Step Name to Allure report</param>
 /// <typeparam name="TActual">The Type being compared.</typeparam>
 /// <param name="del">An ActualValueDelegate returning the value to be tested</param>
 /// <param name="expr">A Constraint expression to be applied</param>
 public bool That <TActual>(string stepName, ActualValueDelegate <TActual> del, IResolveConstraint expr,
                            params object[] stepParams)
 {
     return(VerifyRunner(stepName, () => Assert.That(del, expr.Resolve(), null, null), Status.failed,
                         stepParams));
 }
Example #53
0
 private void Then_message(IResolveConstraint matchesThis)
 {
     Assert.That(_result.Message.Trim(), matchesThis);
 }
Example #54
0
 /// <summary>
 ///     Apply a constraint to an actual value, succeeding if the constraint
 ///     is satisfied and throwing an assertion exception on failure.
 /// </summary>
 /// <param name="stepName">The Step Name to Allure report</param>
 /// <typeparam name="TActual">The Type being compared.</typeparam>
 /// <param name="del">An ActualValueDelegate returning the value to be tested</param>
 /// <param name="expr">A Constraint expression to be applied</param>
 /// <param name="message">The message that will be displayed on failure</param>
 /// <param name="args">Arguments to be used in formatting the message</param>
 public bool That <TActual>(string stepName, ActualValueDelegate <TActual> del, IResolveConstraint expr,
                            string message, params object[] args)
 {
     return(VerifyRunner(stepName, () =>
     {
         var constraint = expr.Resolve();
         TestExecutionContext.CurrentContext.IncrementAssertCount();
         var result = constraint.ApplyTo(del);
         if (!result.IsSuccess)
         {
             ReportFailure(result, message, args);
         }
     }, Status.failed));
 }
 public void AssertOutputVariable(string name, IResolveConstraint resolveConstraint)
 {
     var variable = captured.OutputVariables.Get(name);
     Assert.That(variable, resolveConstraint);
 }
 private static Constraint OperatorAndImplementation(IResolveConstraint left, IResolveConstraint right)
 {
     return new AndConstraint(left.Resolve(), right.Resolve());
 }
Example #57
0
 /// <summary>
 ///     Asserts that the code represented by a delegate throws an exception
 ///     that satisfies the constraint provided.
 /// </summary>
 /// <param name="stepName">The Step Name to Allure report</param>
 /// <param name="code">A TestDelegate to be executed</param>
 /// <param name="constraint">A ThrowsConstraint used in the test</param>
 public bool That(string stepName, TestDelegate code, IResolveConstraint constraint, params object[] stepParams)
 {
     return(VerifyRunner(stepName, () => Assert.That(code, constraint, null, null), Status.failed, stepParams));
 }
Example #58
0
 /// <summary>
 ///     Apply a constraint to a referenced value, succeeding if the constraint
 ///     is satisfied and throwing an assertion exception on failure.
 /// </summary>
 /// <param name="actual">The actual value to test</param>
 /// <param name="constraint">A Constraint to be applied</param>
 /// <param name="message">The message that will be displayed on failure</param>
 internal static void That(ref bool actual, IResolveConstraint constraint, string message)
 {
     That(ref actual, constraint.Resolve(), message, null);
 }
 /// <summary>
 /// Construct given a base constraint
 /// </summary>
 /// <param name="resolvable"></param>
 protected PrefixConstraint(IResolveConstraint resolvable) : base(resolvable)
 {
     if ( resolvable != null )
         this.baseConstraint = resolvable.Resolve();
 }
Example #60
0
 /// <summary>
 ///     Asserts that the code represented by a delegate throws an exception
 ///     that satisfies the constraint provided.
 /// </summary>
 /// <param name="stepName">The Step Name to Allure report</param>
 /// <param name="code">A TestDelegate to be executed</param>
 /// <param name="constraint">A ThrowsConstraint used in the test</param>
 /// <param name="message">The message that will be displayed on failure</param>
 /// <param name="args">Arguments to be used in formatting the message</param>
 public bool That(string stepName, TestDelegate code, IResolveConstraint constraint, string message,
                  params object[] args)
 {
     return(VerifyRunner(stepName, () => Assert.That((object)code, constraint, message, args), Status.failed));
 }