﻿namespace Werm.Tests
{
    using System.Collections.Specialized;
    using System.Net;
    using NUnit.Framework;

    [TestFixture]
    public sealed class Response_Fixture
    {
        private Response response;

        [SetUp]
        public void SetUpTest()
        {
            this.response = new Response();
        }

        [Test]
        public void Should_set_status_code()
        {
            this.response.StatusCode = HttpStatusCode.Conflict;
            Assert.AreEqual(HttpStatusCode.Conflict, this.response.StatusCode);
        }

        [Test]
        public void Should_default_status_code_to_200()
        {
            Assert.AreEqual(HttpStatusCode.OK, this.response.StatusCode);
        }

        [Test]
        public void Should_set_headers()
        {
            var headers = new NameValueCollection();
            this.response.Headers = headers;
            Assert.AreSame(headers, this.response.Headers);
        }

        [Test]
        public void Should_initialize_headers()
        {
            Assert.IsNotNull(this.response.Headers);
        }

        [Test]
        public void Should_set_body()
        {
            const string ResponseBody = "{ \"key\": \"value\" }";
            this.response.Body = ResponseBody;
            Assert.AreEqual(ResponseBody, this.response.Body);
        }
    }
}
