public async Task ListAllGroupInfosAsync_Test() { var mockExecuter = new Mock <IExecuter>(); var mockClusterFactory = new Mock <IClusterFactory>(); mockExecuter.Setup(x => x.Execute(It.IsAny <FastDFSReq <ListAllGroupResp> >(), It.IsAny <string>(), It.IsAny <ConnectionAddress>())).ReturnsAsync(new ListAllGroupResp() { GroupInfos = new List <GroupInfo>() { new GroupInfo() { GroupName = "group1" } } }); IFastDFSClient client = new FastDFSClient(mockExecuter.Object, mockClusterFactory.Object); var groupInfos = await client.ListAllGroupInfosAsync(); Assert.Single(groupInfos); mockExecuter.Verify(x => x.Execute(It.IsAny <FastDFSReq <ListAllGroupResp> >(), It.IsAny <string>(), It.IsAny <ConnectionAddress>()), Times.Once); }