コード例 #1
0
        public void Cache_User()
        {
            var apiObject = new InternalVkApiObject()
            {
                Id = 123, Type = InternalVkObjectType.User
            };

            A.CallTo(() => vkClient.GetUsers(A <InternalVkApiUserGetRequestParams> .Ignored))
            .Returns(new[] { A.Dummy <InternalVkApiUser>() });

            usernameProvider.GetUsernameForObject(apiObject);
            usernameProvider.GetUsernameForObject(apiObject);

            A.CallTo(() => vkClient.GetUsers(A <InternalVkApiUserGetRequestParams> .Ignored))
            .MustHaveHappenedOnceExactly();
        }
コード例 #2
0
 public static InternalVkApiUser GetUserOrDie(this IVkClient client, long id)
 {
     return(client.GetUsers(new InternalVkApiUserGetRequestParams {
         Ids = new[] { id }
     }).Single());
 }