public void AfterCreateArtefact_MyPeersKnowIHaveIt() { Interconnect(MyActor, OtherActor); var artefact = MyActor.CreateArtefact(Artefact.Name); Assert.True(OtherAccount.GetPeer(MyId).HasArtefact(artefact.Id)); }
public void CanCreateTwoDifferentArtefacts() { Interconnect(MyActor, OtherActor); var a1 = MyActor.CreateArtefact(Artefact.Name); var a2 = MyActor.CreateArtefact(AnotherArtefact.Name); Assert.True(OtherAccount.GetPeer(MyId).HasArtefact(a1.Id)); Assert.True(OtherAccount.GetPeer(MyId).HasArtefact(a2.Id)); }
public void WhenCreatingManyTransientArtefacts_IdsAreReused() { var first = MyActor.CreateArtefact("abc"); ((Account)MyAccount)._transientArtefactCount = int.MaxValue - 1; MyActor.CreateArtefact("abc"); var last = MyActor.CreateArtefact("abc"); Assert.Equal(first.Id.Number, last.Id.Number); }
public void AfterOtherAccountCreateAndDestroyArtefact_ICanCreateSameArtefact() { Interconnect(MyActor, OtherActor, ThirdActor); var a1 = OtherActor.CreateArtefact(Artefact.Name); OtherActor.DestroyArtefact(a1.Id); var a2 = MyActor.CreateArtefact(Artefact.Name); Assert.True(ThirdAccount.GetPeer(MyId).HasArtefact(a2.Id)); }
public void IfBuyerDontBelieveSellerHasArtefact_TransactionIsNotAccepted() { Interconnect(MyActor, OtherActor); var artefact = MyActor.CreateArtefact(Artefact.Name); OtherActor.CounterfeitArtefact(artefact); var key = StartTransaction(MyActor, OtherActor, artefact); Assert.NotNull(key); Assert.NotEmpty(key); Assert.False(OtherActor.AcceptTransaction(key)); }
public void WhenActorCreateArtefact_IdIsBasedOnAccountIdWithIncrementalNumber() { var a1 = MyActor.CreateArtefact("abc"); var a2 = MyActor.CreateArtefact("abc"); var b1 = OtherActor.CreateArtefact("abc"); var b2 = OtherActor.CreateArtefact("abc"); Assert.Equal(MyAccount.Id / 1, a1.Id); Assert.Equal(MyAccount.Id / 2, a2.Id); Assert.Equal(OtherAccount.Id / 1, b1.Id); Assert.Equal(OtherAccount.Id / 2, b2.Id); }
public void WhenPeerDestroyArtefactThatPeerDoesntOwn_PeerLoosesTrust() { var artefact = MyActor.CreateArtefact(Artefact.Name); OtherActor.CounterfeitArtefact(artefact); Interconnect(MyActor, OtherActor); var trustBefore = MyAccount.GetTrust(OtherId); OtherActor.DestroyArtefact(artefact.Id); var expectedTrustAfter = trustBefore.Decrease(DestroyOthersArtefactDistrustFactor); Assert.Equal(expectedTrustAfter, MyAccount.GetTrust(OtherId)); }
public void AfterCreateArtefact_SelfHasArtefact() { var artefact = MyActor.CreateArtefact(Artefact.Name); Assert.True(MyAccount.Self.HasArtefact(artefact.Id)); }
public void ThrowsWhenCreatingTooManyResilientArtefacts() { ((Account)MyAccount)._resilientArtefactCount = int.MaxValue - 1; MyActor.CreateArtefact("abc", true); Assert.Throws <OutOfBounds <uint> >(() => MyActor.CreateArtefact("abc", true)); }
public void WhenCreateResilientArtefact_NumberIsAtLeastIntMax() { var artefact = MyActor.CreateArtefact("abc", true); Assert.InRange(artefact.Id.Number, (uint)int.MaxValue, uint.MaxValue); }
public void WhenCreateTransientArtefact_NumberIsLessThanIntMax() { var artefact = MyActor.CreateArtefact("abc"); Assert.InRange(artefact.Id.Number, (uint)0, (uint)(int.MaxValue - 1)); }