public async Task GetMyPackagesMethodWillInvokeMyPackagesUrl()
        {
            mockBlockService.Setup(m => m.InvokeGet(HyperledgerConsts.MyPackagesUrl(TestJsonObjectConsts.trader1ID)))
            .ReturnsAsync("[]");
            mockBlockService.Setup(m => m.InvokeGet(HyperledgerConsts.TraderQueryURL(TestJsonObjectConsts.trader1ID)))
            .ReturnsAsync(TestJsonObjectConsts.trader1);
            mockBlockService.Setup(m => m.InvokePostAuthentication(FlaskConsts.LoginUrl, JsonConvert.SerializeObject(user)))
            .ReturnsAsync(TestJsonObjectConsts.trader1AuthenticationMessage);

            await clientWithMock.Login(user);

            List <Package> results = await clientWithMock.GetMyPackages();

            mockBlockService.Verify(m => m.InvokeGet(HyperledgerConsts.MyPackagesUrl(TestJsonObjectConsts.trader1ID)));
        }
Ejemplo n.º 2
0
        void UpdatePackageList(BlockchainClient localClient)
        {
            packagesOwn.Clear();
            var packages = Task.Run(() => localClient.GetMyPackages()).Result;

            foreach (var package in packages)
            {
                packagesOwn.Add(package);
            }
        }