public async Task If_network_is_down_cant_get_property() { 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); mockBlockService.Setup(m => m.InvokeGet(HyperledgerConsts.MyAssetsUrl(TestJsonObjectConsts.trader1ID))) .ThrowsAsync(new HttpRequestException()); await clientWithMock.Login(user); List <Property> results = await clientWithMock.GetMyProperties(); Assert.IsNull(results); }
public async Task Get_My_Assets_Will_InvokeGet_From_BlockchainService() { 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); mockBlockService.Setup(m => m.InvokeGet(HyperledgerConsts.MyAssetsUrl(TestJsonObjectConsts.trader1ID))) .ReturnsAsync("[]"); await clientWithMock.Login(user); List <Property> results = await clientWithMock.GetMyProperties(); mockBlockService.Verify(m => m.InvokeGet(HyperledgerConsts.TraderQueryURL(TestJsonObjectConsts.trader1ID))); }