Beispiel #1
0
      public async Task EnumSelfCompareSmokeTest()
      {
          HttpClient client = new HttpClient();

          client.DefaultRequestHeaders.Accept.Clear();
          client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

          string uriString             = $"{BaseUrl}/{nameof(SampleDto)}?$filter=enum eq enum"; // MappingStack.Dynamo.Testing.TestFactory.ModelFactory.EnumScalar'EnumScalarSecond'
          Task <HttpResponseMessage> a = client.GetAsync(new Uri(uriString));

          a.Should().NotBeNull();
          HttpResponseMessage response = await a;

          response.Should().NotBeNull();

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

          response.IsSuccessStatusCode.Should().BeTrue();
          TResult result = await response.Content.ReadAsAsync <TResult>();

          result.Should().NotBeNull().And.BeOfType <TResult>();
      }
Beispiel #2
0
      private static async Task EnumLiteralTest(string enumLiteral)
      {
          HttpClient client = new HttpClient();

          client.DefaultRequestHeaders.Accept.Clear();
          client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

          SampleDto dto                = null;
          string    uriString          = $"{InProcess.LocalHttp}/{RoutePrefix}/{nameof(SampleDto)}?$filter={nameof(dto.@enum)} eq {enumLiteral}";
          Task <HttpResponseMessage> a = client.GetAsync(new Uri(uriString));

          a.Should().NotBeNull();
          HttpResponseMessage response = await a;

          response.Should().NotBeNull();

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

          response.IsSuccessStatusCode.Should().BeTrue(s.Replace("{", "{{").Replace("}", "}}"));
          TResult result = await response.Content.ReadAsAsync <TResult>();

          result.Should().NotBeNull().And.BeOfType <TResult>();
      }