Пример #1
0
            public void Should_Add_Single_Header()
            {
                //Given
                HttpSettings settings = new HttpSettings();

                //When
                settings.AppendHeader("Content-Type", "application/json");

                //Then
                Assert.NotNull(settings.Headers);
                Assert.True(settings.Headers.ContainsKey("Content-Type"));
                Assert.Equal(settings.Headers["Content-Type"], "application/json", StringComparer.OrdinalIgnoreCase);
            }
Пример #2
0
            public void Should_Replace_Existing_Header()
            {
                //Given
                HttpSettings settings = new HttpSettings()
                {
                    Headers = new Dictionary <string, string>
                    {
                        ["Content-Type"] = "application/json",
                        ["Accept"]       = "application/xml"
                    }
                };

                //When
                settings.AppendHeader("Content-Type", "text/xml");

                //Then
                Assert.Equal(settings.Headers["Content-Type"], "text/xml", StringComparer.OrdinalIgnoreCase);
            }