/// <summary>
        /// Asserts that the Items contain the the expected Key Value Pair.
        /// </summary>
        /// <param name="expectedKey">The expected Key in Items.</param>
        /// <param name="expectedValue">The expected Value in Items.</param>
        /// <param name="reason">
        /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
        /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
        /// </param>
        /// <param name="reasonArgs">
        /// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
        /// </param>
        public ChallengeResultAssertions ContainsItem(string expectedKey, string expectedValue, string reason = "", params object[] reasonArgs)
        {
            var actualItems = Items;

            AssertionHelpers.AssertStringObjectDictionary(actualItems, "ChallengeResult.AuthenticationProperties.Items", expectedKey, expectedValue, reason, reasonArgs);

            return(this);
        }
示例#2
0
        public RedirectToRouteAssertions WithRouteValue(string key, object expectedValue, string reason = "", params object[] reasonArgs)
        {
            var routeValues = Subject.RouteValues;

            AssertionHelpers.AssertStringObjectDictionary(routeValues, "RedirectToRouteResult.RouteValues", key, expectedValue, reason, reasonArgs);

            return(this);
        }
示例#3
0
        /// <summary>
        /// Asserts that the route data has the expected data token.
        /// </summary>
        /// <param name="key">The expected data token key value.</param>
        /// <param name="expectedValue">The expected data token value.</param>
        /// <param name="reason">
        /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
        /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
        /// </param>
        /// <param name="reasonArgs">
        /// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
        /// </param>
        public RouteDataAssertions HaveDataToken(string key, object expectedValue, string reason = "", params object[] reasonArgs)
        {
            var subjectTyped = Subject as RouteData;

            AssertionHelpers.AssertStringObjectDictionary(subjectTyped.DataTokens, "RouteData.DataTokens", key, expectedValue, reason, reasonArgs);

            return(this);
        }
示例#4
0
        /// <summary>
        /// Asserts that the redirect has the expected route value.
        /// </summary>
        /// <param name="key">The expected key.</param>
        /// <param name="expectedValue">The expected value.</param>
        /// <param name="reason">
        /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
        /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
        /// </param>
        /// <param name="reasonArgs">
        /// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
        /// </param>
        public RedirectToActionResultAssertions WithRouteValue(string key, object expectedValue, string reason = "", params object[] reasonArgs)
        {
            var subjectTyped = RedirectToActionResultSubject;

            AssertionHelpers.AssertStringObjectDictionary(subjectTyped.RouteValues, "RedirectToActionResult.RouteValues", key, expectedValue, reason, reasonArgs);

            return(this);
        }
示例#5
0
        /// <summary>
        /// Asserts that the redirect has the expected route value.
        /// </summary>
        /// <param name="key">The expected key.</param>
        /// <param name="expectedValue">The expected value.</param>
        /// <param name="reason">
        /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
        /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
        /// </param>
        /// <param name="reasonArgs">
        /// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
        /// </param>
        public AcceptedAtRouteResultAssertions WithRouteValue(string key, object expectedValue, string reason = "", params object[] reasonArgs)
        {
            var actualRouteValues = ObjectResultSubject.RouteValues;

            AssertionHelpers.AssertStringObjectDictionary(actualRouteValues,
                                                          "AcceptedAtRouteResult.RouteValues", key, expectedValue, reason, reasonArgs);

            return(this);
        }
示例#6
0
        /// <summary>
        ///     Asserts that the temp data contains the expected data.
        /// </summary>
        /// <param name="key">The expected temp data key.</param>
        /// <param name="expectedValue">The expected temp data.</param>
        /// <param name="reason">
        ///     A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
        ///     is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
        /// </param>
        /// <param name="reasonArgs">
        ///     Zero or more objects to format using the placeholders in <paramref name="reason"/>.
        /// </param>
        public PartialViewResultAssertions WithTempData(string key, object expectedValue, string reason = "",
                                                        params object[] reasonArgs)
        {
            var actualTempData = PartialViewResultSubject.TempData;

            AssertionHelpers.AssertStringObjectDictionary(actualTempData, "PartialViewResult.TempData",
                                                          key, expectedValue, reason, reasonArgs);

            return(this);
        }