public HttpResponse ResourceFile(string resourceName, string[] propertiesToIgnore)
        {
            if (string.IsNullOrEmpty(resourceName))
            {
                throw new ArgumentNullException(nameof(resourceName));
            }
            if (propertiesToIgnore == null)
            {
                throw new ArgumentNullException(nameof(propertiesToIgnore));
            }

            var content = ContentProvider.GetAsString(resourceName);

            if (string.IsNullOrEmpty(content))
            {
                throw new InvalidOperationException($"Resource \"{resourceName}\" was not found");
            }

            var config = new JsonVerifierSettings
            {
                IgnoredProperties = propertiesToIgnore
            };

            _buider.RequestExpectation(
                new BodyContentExpectation(
                    content,
                    Config.JsonVerifierFactory(config)));

            return(_buider);
        }
예제 #2
0
        public HttpResponse Matches(string expectedContent, params string[] propertiesToIgnore)
        {
            if (propertiesToIgnore == null)
            {
                throw new ArgumentNullException(nameof(propertiesToIgnore));
            }
            if (string.IsNullOrEmpty(expectedContent))
            {
                throw new ArgumentException("Value cannot be null or empty.", nameof(expectedContent));
            }

            var config = new JsonVerifierSettings
            {
                IgnoredProperties = propertiesToIgnore
            };

            _builder.RequestExpectation(
                new BodyContentExpectation(
                    expectedContent,
                    Config.JsonVerifierFactory(config)));

            return(_builder);
        }