Exemplo n.º 1
0
        public void Add_Send_Json_Message_To_Queue()
        {
            var    profile      = new Profile();
            string expectedJson = "{test: 233}";
            var    expectedId   = Guid.NewGuid().ToString();

            _mockResponse = expectedId;
            _serializer.Serialize(profile).Returns(expectedJson);
            var actualId = _adapter.Add(profile);

            _serializer.Received().Serialize(profile);
            Assert.AreEqual(_requests.First().Headers["Content-Type"], _applicationJsonHeader);
            Assert.AreEqual(_requests.First().Headers["Accept"], _applicationJsonHeader);
            Assert.That(_requests.First().Url.LocalPath, Is.EqualTo("/api/Queue/Add"));
            Assert.That(_requests.First().HttpMethod, Is.EqualTo("POST"));
            Assert.AreEqual(actualId, expectedId);
        }