public ProducerConfigurationsBusinessModel ToModel() { var toRet = new ProducerConfigurationsBusinessModel(); toRet.Account = this.Account; if (this.MaxRatioToStake != null) { toRet.MaxRatioToStake = double.Parse(MaxRatioToStake, CultureInfo.InvariantCulture); } if (this.MinBBTPerMbRatio != null) { toRet.MinBBTPerMbRatio = double.Parse(MinBBTPerMbRatio, CultureInfo.InvariantCulture); } if (this.MaxGrowthPerMonth != null) { toRet.MaxGrowthPerMonth = double.Parse(this?.MaxGrowthPerMonth, CultureInfo.InvariantCulture); } if (this.MaxSidechains != null) { toRet.MaxSidechains = double.Parse(MaxSidechains, CultureInfo.InvariantCulture); } if (this.MaxBBTPerEmptyBlock != null) { toRet.MaxBBTPerEmptyBlock = double.Parse(MaxBBTPerEmptyBlock, CultureInfo.InvariantCulture); } if (this.MaxSidechainGrowthPerMonth != null) { toRet.MaxSidechainGrowthPerMonth = double.Parse(MaxSidechainGrowthPerMonth, CultureInfo.InvariantCulture); } if (this.MaxStakeToMonthlyIncomeRatio != null) { toRet.MaxStakeToMonthlyIncomeRatio = double.Parse(MaxStakeToMonthlyIncomeRatio, CultureInfo.InvariantCulture); } return(toRet); }
public ProducerConfigurationViewModel(ProducerConfigurationsBusinessModel bm) { Account = bm.Account; MaxRatioToStake = bm.MaxRatioToStake.ToString(); MinBBTPerMbRatio = bm.MinBBTPerMbRatio.ToString(); MaxGrowthPerMonth = bm.MaxGrowthPerMonth.ToString(); MaxSidechains = bm.MaxSidechains.ToString(); MaxBBTPerEmptyBlock = bm.MaxBBTPerEmptyBlock.ToString(); MaxSidechainGrowthPerMonth = bm.MaxSidechainGrowthPerMonth.ToString(); MaxStakeToMonthlyIncomeRatio = bm.MaxStakeToMonthlyIncomeRatio.ToString(); }
public void TestProducerConfigBusinessModel() { var model = new ProducerConfigurationsBusinessModel() { MaxBBTPerEmptyBlock = -1 }; Assert.IsTrue(model.HasNegativeValues()); model.MaxBBTPerEmptyBlock++; Assert.IsTrue(!model.HasNegativeValues()); }