Skip to content

Instantly share code, notes, and snippets.

@jgc128
Created November 13, 2013 19:13
Show Gist options
  • Save jgc128/7454617 to your computer and use it in GitHub Desktop.
Save jgc128/7454617 to your computer and use it in GitHub Desktop.
Moq
var ret = JObject.Parse(@"{
'response': [{
id: 205387401,
first_name: 'Tom',
last_name: 'Cruise',
sex: 2,
city: '5331',
country: '9'
}]}");
Mock<IApi> mock = new Mock<IApi>();
mock.Setup<Task<JObject>>(a => a.ExecuteRequest(It.IsAny<string>(), It.IsAny<Dictionary<string, string>>())).Returns(Task.FromResult(ret));
VkUserCollector userCollector = new VkUserCollector(mock.Object);
var result = await userCollector.GetUserInfo(1);
Assert.AreEqual(205387401, result.Id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment