Ejemplo n.º 1
0
        public void IfPeerDontAgreeGiverHasArtefact_TransactionIsNotAcceptedByDisagreeingPeer()
        {
            Interconnect(MyActor, OtherActor);
            var artefact = OtherActor.CreateArtefact(Artefact.Name);

            ThirdActor.CounterfeitArtefact(artefact);
            Interconnect(MyActor, OtherActor, ThirdActor);
            MyAccount.SetTrust(OtherId, (SignedWeight)1);
            MyAccount.SetTrust(ThirdId, (SignedWeight)1);

            Assert.True(MakeTransaction(OtherActor, MyActor, artefact));
            Assert.True(ThirdAccount.Self.HasArtefact(artefact.Id));
        }
Ejemplo n.º 2
0
        public void WhenPeerCreateArtefactThatOtherPeerAlreadyHas_PeerLoosesTrust()
        {
            Interconnect(MyActor, OtherActor, ThirdActor);
            var otherTrustBefore = MyAccount.GetTrust(OtherId);
            var thirdTrustBefore = MyAccount.GetTrust(ThirdId);

            var artefact = OtherActor.CreateArtefact(Artefact.Name);

            ThirdActor.CounterfeitArtefact(artefact);

            Assert.Equal(otherTrustBefore, MyAccount.GetTrust(OtherId));
            var expectedThirdTrust = thirdTrustBefore.Decrease(MakeCounterfeitArtefactDistrustFactor);

            Assert.Equal(expectedThirdTrust, MyAccount.GetTrust(ThirdId));
        }