Beispiel #1
0
        public async Task Get_Next_If_Not_Prime_Or_Current_Returns_OK(string number, int outputNumber)
        {
            var request = new GetNextIfNotPrimeOrCurrentRequest
            {
                Number = number
            };

            var queryString = _queryStringFactory.Create(request);

            var result = await _client.GetAsync($"api/prime-numbers/next{queryString}");

            var content = await result.Content.ReadAsStringAsync();

            var response = JsonConvert.DeserializeObject <GetNextIfNotPrimeOrCurrentResponse>(content);

            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
            Assert.Equal(outputNumber, response.Number);
        }
        public async Task Check_Is_Prime_Number_Returns_OK(string number, bool isPrimerNumber)
        {
            var request = new CheckIsPrimeNumberRequest
            {
                Number = number
            };

            var queryString = _queryStringFactory.Create(request);

            var result = await _client.GetAsync($"api/prime-numbers/check{queryString}");

            var content = await result.Content.ReadAsStringAsync();

            var response = JsonConvert.DeserializeObject <CheckIsPrimeNumberResponse>(content);

            Assert.Equal(HttpStatusCode.OK, result.StatusCode);
            Assert.Equal(isPrimerNumber, response.IsPrime);
        }
 public void WhenCreatingAQueryStringFromALogon()
 {
     _logon  = Guid.NewGuid().ToString();
     _result = _factory.Create(_logon, WithFeedbackRequest());
 }