public async Task GetPackagesServerInfo() { var client = new Mock <ISynoWebApi>(); client.Setup(c => c.ExecuteAsync <SynologyResponse <SynologyPackageInfo> >(It.IsAny <IRestRequest>())) .ReturnsAsync(new RestResponse <SynologyResponse <SynologyPackageInfo> >() { Data = new SynologyResponse <SynologyPackageInfo>() { Data = new SynologyPackageInfo() } }); var c = new SynoPackageClient(client.Object); var result = await c.GetPackagesInfo(); Assert.IsNotNull(result); }
public async Task Resource() { var client = new Mock <ISynoWebApi>(); client.Setup(c => c.ExecuteAsync <SynologyResponse <SynologyPackageInfo> >(It.IsAny <IRestRequest>())) .ReturnsAsync(new RestResponse <SynologyResponse <SynologyPackageInfo> >() { Data = new SynologyResponse <SynologyPackageInfo>() { Data = new SynologyPackageInfo() } }); var c = new SynoPackageClient(client.Object); var result = await c.GetPackagesInfo(); client.Verify(c => c.ExecuteAsync <SynologyResponse <SynologyPackageInfo> >(It.Is <SynologyRestRequest>(arg => arg.Resource == "/entry.cgi"))); }
public async Task ServiceApiName() { var client = new Mock <ISynoWebApi>(); client.Setup(c => c.ExecuteAsync <SynologyResponse <SynologyPackageInfo> >(It.IsAny <IRestRequest>())) .ReturnsAsync(new RestResponse <SynologyResponse <SynologyPackageInfo> >() { Data = new SynologyResponse <SynologyPackageInfo>() { Data = new SynologyPackageInfo() } }); var c = new SynoPackageClient(client.Object); var result = await c.GetPackagesInfo(); client.Verify(c => c.ExecuteAsync <SynologyResponse <SynologyPackageInfo> >(It.Is <SynologyRestRequest>(arg => arg.Parameters.Any(p => p.Value != null && p.Value.ToString() == "SYNO.Core.Package")))); }