public async Task <IActionResult> Post([FromBody] ClientPreference clientPreference)
 {
     if (clientPreference != null)
     {
         return(Ok(await clientPreference.Add()));
     }
     return(BadRequest("Parameters are null"));
 }
        public void AnnotationFilterShouldNotBeSetAndRequiredResponseVersionShouldBe10WhenTheODataAnnotationsPreferenceIsMissing()
        {
            RequestDescription   descrption     = new RequestDescription(RequestTargetKind.Link, RequestTargetSource.ServiceOperation, new Uri("http://service/set"));
            IODataRequestMessage requestMessage = new ODataRequestMessageSimulator();
            ClientPreference     preference     = new ClientPreference(descrption, HttpVerbs.None, requestMessage, effectiveMaxResponseVersion: VersionUtil.Version4Dot0);

            preference.AnnotationFilter.Should().BeNull();
            preference.RequiredResponseVersion.Should().Be(VersionUtil.Version4Dot0);
        }
        public void AnnotationFilterShouldBeSetWithODataAnnotationsPreferenceAndRequiredResponseVersionShouldBe30WhenEffectiveMaxResponseVersionIs30()
        {
            RequestDescription   descrption     = new RequestDescription(RequestTargetKind.Link, RequestTargetSource.ServiceOperation, new Uri("http://service/set"));
            IODataRequestMessage requestMessage = new ODataRequestMessageSimulator();

            requestMessage.PreferHeader().AnnotationFilter = "*";
            ClientPreference preference = new ClientPreference(descrption, HttpVerbs.None, requestMessage, effectiveMaxResponseVersion: VersionUtil.Version4Dot0);

            preference.AnnotationFilter.Should().Be("*");
            preference.RequiredResponseVersion.Should().Be(VersionUtil.Version4Dot0);
        }
Beispiel #4
0
 public static bool TryGetValue <T>(this ClientPreferences prefs, ClientPreference pref, out T value)
 {
     value = default !;