コード例 #1
0
        public void WhenConnectPeer_PeerIsSynced()
        {
            Interconnect(MyActor, OtherActor);
            Interconnect(ThirdActor, OtherActor);
            OtherAccount.SetMoney(ThirdId, (Money)100);
            MyAccount.SetTrust(OtherId, SignedWeight.Max);

            MyActor.Connect(ThirdId);

            Assert.Equal((Money)50, MyAccount.GetMoney(ThirdId));
        }
コード例 #2
0
        public void Given_1_PeerWithFullTrustAndConnectivity_WhenSyncSelf_ThenGetMeanPeerMoney(
            float myMoneyBefore, float peerAssessment, float myMoneyAfter)
        {
            Interconnect(MyActor, OtherActor);
            OtherAccount.SetMoney(MyId, (Money)peerAssessment);
            MyAccount.Self.Money = (Money)myMoneyBefore;
            MyAccount.SetTrust(OtherId, (SignedWeight)1);

            MyActor.SyncAll();

            Assert.Equal(myMoneyAfter, MyAccount.Self.Money);
        }
コード例 #3
0
        public void Given_2_PeersWithFullConnectivity_WhenSyncSelf_ThenGetMeanWeightedByTrustPeerMoney(
            float myMoneyBefore,
            float firstPeerTrust,
            float firstPeerAssessment,
            float secondPeerTrust,
            float secondPeerAssessment,
            float myMoneyAfter)
        {
            Interconnect(MyActor, OtherActor, ThirdActor);
            OtherAccount.SetMoney(MyId, (Money)firstPeerAssessment);
            ThirdAccount.SetMoney(MyId, (Money)secondPeerAssessment);
            MyAccount.Self.Money = (Money)myMoneyBefore;
            MyAccount.SetTrust(OtherId, (SignedWeight)firstPeerTrust);
            MyAccount.SetTrust(ThirdId, (SignedWeight)secondPeerTrust);

            MyActor.SyncAll();

            Assert.Equal(myMoneyAfter, MyAccount.Self.Money);
        }