示例#1
0
        //[Ignore("Need to fix jwt setting value and handle 401 error")]
        public async Task GetFizzResult(string method, string URL)
        {
            using var client = new TestClientProvider().Client;
            var request  = new HttpRequestMessage(new HttpMethod(method), URL);
            var response = await client.SendAsync(request);

            // response.EnsureSuccessStatusCode();

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
        }
示例#2
0
        public async Task FizzResult()
        {
            Random r      = new Random();
            int    number = r.Next(1, 101);

            using var client = new TestClientProvider().Client;
            var request = new HttpRequestMessage(
                new HttpMethod("GET"), $"api/v1/Fizz/{number}");

            var response = await client.SendAsync(request);

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
        }
示例#3
0
        public async Task OutsideFizzConstraint()
        {
            Random r      = new Random();
            int    number = r.Next(102, 1000);

            using var client = new TestClientProvider().Client;

            var request = new HttpRequestMessage(new HttpMethod("GET"),
                                                 $"api/v1/Fizz/{number}");

            var response = await client.SendAsync(request);

            //response.EnsureSuccessStatusCode();

            var res = await response.Content.ReadAsStringAsync();

            var parsedResult = res.ToString().Split(new[] { ',', ':' }, StringSplitOptions.RemoveEmptyEntries);

            response.StatusCode = parsedResult[1].Equals("500") ? HttpStatusCode.BadRequest : HttpStatusCode.Ambiguous;

            Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode);
        }