コード例 #1
0
        public void AfterPeerEndorceArtefact_ArtefactOwnerIncreaseMoney(
            float trustForEndorcingPeer,
            float relationOfEndorcingPeerToEndorcedPeer,
            float expectedIncrease)
        {
            Interconnect(MyActor, OtherActor, ThirdActor);
            MyAccount.SetTrust(OtherId, (SignedWeight)trustForEndorcingPeer);
            MyAccount.SetRelationWeight(OtherId, ThirdId, (Weight)relationOfEndorcingPeerToEndorcedPeer);
            var artefact = ThirdActor.CreateArtefact(Artefact.Name);

            OtherActor.EndorceArtefact(artefact);

            Assert.Equal(expectedIncrease, MyAccount.GetMoney(ThirdId));
        }
コード例 #2
0
        public void WhenPeerEndorceArtefactWithWrongOwner_PeerLoosesTrust()
        {
            Interconnect(MyActor, OtherActor, ThirdActor);
            var artefact    = ThirdActor.CreateArtefact(Artefact.Name);
            var trustBefore = MyAccount.GetTrust(OtherId);

            OtherAccount.ForgetArtefact(artefact.Id);

            var fakeArtefact = new Artefact(artefact, OtherId);

            OtherActor.EndorceArtefact(fakeArtefact);

            var expectedTrust = trustBefore.Decrease(EndorceCounterfeitArtefactDistrustFactor);

            Assert.Equal(expectedTrust, MyAccount.GetTrust(OtherId));
        }