private void AssertResults(MessagingPollCreationAttachment attachment, GetPollResultReply getPollResult) { var results = getPollResult.Results; AssertEquals(attachment.Options.Count, results.Count, "Results count"); results.Where(r => !r.Result.HasValue).ToList().ForEach(r => AssertEquals(0, r.Weight, "Weight")); }
private static void AssertHoldingId(MessagingPollCreationAttachment attachment, GetPollResultReply getPollResult) { if (attachment.MinBalanceModel != MinBalanceModel.Nqt && attachment.MinBalanceModel != MinBalanceModel.None) { AssertIsLargerThanZero(getPollResult.HoldingId, "HoldingId"); } else { AssertEquals(0, getPollResult.HoldingId, "HoldingId"); } }
private void AssetDecimals(MessagingPollCreationAttachment attachment, GetPollResultReply getPollResult) { if (attachment.MinBalanceModel == MinBalanceModel.Asset) { var assetReply = _assetExchangeService.GetAsset(attachment.HoldingId).Result; AssertEquals(assetReply.Decimals, getPollResult.Decimals, "Decimals"); } else if (attachment.MinBalanceModel == MinBalanceModel.Currency) { var currency = _monetarySystemService.GetCurrency(CurrencyLocator.ByCurrencyId(attachment.HoldingId)).Result; AssertEquals(currency.Decimals, getPollResult.Decimals, "Decimals"); } }
private static void VerifyCreatePollParameters(CreatePollParameters createPollParameters, MessagingPollCreationAttachment pollCreation) { AssertEquals(createPollParameters.Name, pollCreation.Name, "poll Name"); AssertEquals(createPollParameters.Description, pollCreation.Description, "poll Description"); AssertEquals(createPollParameters.FinishHeight, pollCreation.FinishHeight, "poll FinishHeight"); AssertEquals(createPollParameters.VotingModel, pollCreation.VotingModel, "poll VotingModel"); AssertEquals(createPollParameters.MinNumberOfOptions, pollCreation.MinNumberOfOptions, "poll MinNumberOfOptions"); AssertEquals(createPollParameters.MaxNumberOfOptions, pollCreation.MaxNumberOfOptions, "poll MaxNumberOfOptions"); AssertEquals(createPollParameters.MinRangeValue, pollCreation.MinRangeValue, "poll MinRangeValue"); AssertEquals(createPollParameters.MaxRangeValue, pollCreation.MaxRangeValue, "poll MaxRangeValue"); AssertEquals(createPollParameters.Options, pollCreation.Options, "poll Options"); AssertEquals(createPollParameters.MinBalance, pollCreation.MinBalance, "poll MinRangeValue"); AssertEquals(createPollParameters.MinBalanceModel, pollCreation.MinBalanceModel, "poll MinBalanceModel"); AssertEquals(createPollParameters.HoldingId ?? 0, pollCreation.HoldingId, "poll HoldingId"); }