public void StartStaking_OnProofOfWorkNetwork_Returns_MethodNotAllowed() { { Mock <IFullNode> fullNodeWithPowConsensus = new Mock <IFullNode>(); fullNodeWithPowConsensus.Setup(i => i.Network).Returns(new BitcoinRegTest()); fullNodeWithPowConsensus.Setup(f => f.NodeService <IWalletManager>(false)) .Returns(this.walletManager.Object); this.controller = new StakingController(fullNodeWithPowConsensus.Object, this.LoggerFactory.Object, this.walletManager.Object); IActionResult startStakingResult = this.controller.StartStaking(new StartStakingRequest() { Name = "myWallet", Password = "******" }); var errorResult = Assert.IsType <ErrorResult>(startStakingResult); var errorResponse = Assert.IsType <ErrorResponse>(errorResult.Value); Assert.Single(errorResponse.Errors); ErrorModel error = errorResponse.Errors[0]; Assert.Equal(405, error.Status); Assert.Equal("Method not available if not Proof of Stake", error.Description); } }
public StakingControllerTest() { this.fullNode = new Mock <IFullNode>(); this.posMinting = new Mock <IPosMinting>(); this.walletManager = new Mock <IWalletManager>(); this.timeSyncBehaviorState = new Mock <ITimeSyncBehaviorState>(); this.controller = new StakingController(this.fullNode.Object, this.LoggerFactory.Object, this.walletManager.Object, this.posMinting.Object); }
public StakingControllerTest() { this.fullNode = new Mock <IFullNode>(); this.posMinting = new Mock <IPosMinting>(); this.walletManager = new Mock <IWalletManager>(); this.timeSyncBehaviorState = new Mock <ITimeSyncBehaviorState>(); this.fullNode.Setup(i => i.Network).Returns(KnownNetworks.StraxTest); this.controller = new StakingController(this.fullNode.Object, this.LoggerFactory.Object, this.walletManager.Object, this.posMinting.Object); }
public void GetStakingInfo_WithoutPosMinting_ReturnsEmptyStakingInfoModel() { this.controller = new StakingController(this.fullNode.Object, this.LoggerFactory.Object, this.walletManager.Object); IActionResult response = this.controller.GetStakingInfo(); var jsonResult = Assert.IsType <JsonResult>(response); var result = Assert.IsType <GetStakingInfoModel>(jsonResult.Value); Assert.Equal(JsonConvert.SerializeObject(new GetStakingInfoModel()), JsonConvert.SerializeObject(result)); }