Beispiel #1
0
        /// <summary>
        /// Tvrdi, ze hodnota nie je null
        /// </summary>
        /// <param name="actualContent">Aktualny Http content</param>
        /// <param name="failedValidationAction">Nastavenie chybovej hlasky</param>
        public static void ShouldNotBeNull(
            HttpContent actualContent,
            Action <string, string, string, string> failedValidationAction
            )
        {
            var actualResponseValuesToString = actualContent.ReadAsStringAsync().Result;

            bool result = CommonValidator.ValidateBinding(() => actualResponseValuesToString.Should().NotBeNull());

            if (!result)
            {
                failedValidationAction(
                    $"actual object value ",
                    $"should Be Not null, ",
                    "but was in fact different!",
                    string.Empty);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Tvrdenie, ze pocet poloziek v kolekcii je mensi alebo rovnaky ako ocakavana hodnota
        /// </summary>
        /// <param name="actualContent">Aktualny Http content</param>
        /// <param name="value">Ocakavana hodnota objektu</param>
        /// <param name="failedValidationAction">Nastavenie chybovej hlasky</param>
        public static void ShouldHaveCountLessOrEqualTo(
            HttpContent actualContent,
            int value,
            Action <string, string, string, string> failedValidationAction)
        {
            var actualResponseValuesToArray = Check(actualContent, failedValidationAction);

            bool result = CommonValidator.ValidateBinding(() => actualResponseValuesToArray.Count.As <JArray>().Should().HaveCountLessOrEqualTo(value));

            if (!result)
            {
                failedValidationAction(
                    $"actual object values [{actualResponseValuesToArray.Count}] ",
                    $"should Have Count Less Or Equal To with expected [{value}], ",
                    $"but was in fact different!",
                    string.Empty);
            }

            Reporter.Pass($"Check actual [{actualResponseValuesToArray.Count}] should have count less or equal To [{value}] ", CodeBlockType.Label);
        }