Created
November 13, 2013 19:13
-
-
Save jgc128/7454617 to your computer and use it in GitHub Desktop.
Moq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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