public void Count_Sets_Api_Token_Header_If_Token_Source_Is_specified() { _mockResponse = "33"; var token = "3314-3040-4420_any_text"; var tokenSource = Substitute.For <IApiTokenSource>(); tokenSource.GetToken().Returns(token); _adapter = new HttpAdapter <Profile>(_defaultAddress, _serializer, _messageSerializer, tokenSource); _adapter.Count(); Assert.That(_requests.First().Headers["Api-Token"], Is.EqualTo(token)); }
public void Count_Request_Include_Category() { _mockResponse = "1233"; var actual = _adapter.Count(); var request = _requests.First(); Assert.AreEqual(request.Headers["Content-Type"], _applicationJsonHeader); Assert.AreEqual(request.Headers["Accept"], _applicationJsonHeader); Assert.That(request.Url.LocalPath, Is.EqualTo("/api/Queue/Count")); Assert.AreEqual(request.Url.Query, $"?category={typeof(Profile).Name}"); Assert.That(request.HttpMethod, Is.EqualTo("GET")); Assert.AreEqual(actual, int.Parse(_mockResponse)); }