public void GetAll_Called_CallsBuildUriWithFieldId() { // Given _client.Setup(b => b.BuildUri(It.IsAny<string>(), It.IsAny<string>())).Returns(new Uri("http://search")); var userResource = new UserResource(_client.Object); // When userResource.GetAll(new List<long> { 4321, 3456, 6789 }); // Then _client.Verify(c => c.BuildUri(It.Is<string>(s => s.Contains("/show_many")), It.Is<string>(st => st.Contains("4321,3456,6789")))); }
public void GetAll_Called_ReturnsUserResponse() { // Given var response = new UserListResponse { Results = new List<User> { new User { Id = 1 } } }; _client.Setup(b => b.Get<UserListResponse>(It.IsAny<Uri>())).Returns(response); var userResource = new UserResource(_client.Object); // When var result = userResource.GetAll(new List<long> { 4321, 3456, 6789 }); // Then Assert.That(result, Is.EqualTo(response)); }
public void GetAll_Called_CallsBuildUriWithFieldId() { // Given _client.Setup(b => b.BuildUri(It.IsAny <string>(), It.IsAny <string>())).Returns(new Uri("http://search")); var userResource = new UserResource(_client.Object); // When userResource.GetAll(new List <long> { 4321, 3456, 6789 }); // Then _client.Verify(c => c.BuildUri(It.Is <string>(s => s.Contains("/show_many")), It.Is <string>(st => st.Contains("4321,3456,6789")))); }
public void GetAll_Called_ReturnsUserResponse() { // Given var response = new UserListResponse { Results = new List <User> { new User { Id = 1 } } }; _client.Setup(b => b.Get <UserListResponse>(It.IsAny <Uri>())).Returns(response); var userResource = new UserResource(_client.Object); // When var result = userResource.GetAll(new List <long> { 4321, 3456, 6789 }); // Then Assert.That(result, Is.EqualTo(response)); }