Exemplo n.º 1
0
            public async Task ThenActionIsDenied(SupplierId subsidiaryId, SupplierId parentId)
            {
                var supplier = new Supplier(subsidiaryId);
                await supplier.CreateAcceptedLink(parentId, _publisherStub);

                await Assert.ThrowsAsync <AlreadyAccepted>(() => supplier.AcceptLink(parentId, _publisherStub));
            }
Exemplo n.º 2
0
            public async Task ThenActionIsDenied(SupplierId supplierId, SupplierId parentId, SupplierId secondParentId)
            {
                var supplier = new Supplier(supplierId);
                await supplier.CreateAcceptedLink(parentId, _publisherStub);

                await Assert.ThrowsAsync <AlreadyLinkedWithParent>(() => supplier.CreateAcceptedLink(secondParentId, _publisherStub));
            }
Exemplo n.º 3
0
            public async Task ThenPendingLinkCreationWithChildIsDenied(SupplierId supplierId, SupplierId childId)
            {
                var supplier = new Supplier(supplierId, new List <SupplierId> {
                    childId
                });

                await Assert.ThrowsAsync <CannotLinkWithChild>(() => supplier.CreatePendingLink(childId, _publisherStub));
            }
Exemplo n.º 4
0
            public async Task ThenActionIsDenied(SupplierId supplierId, SupplierId parentId)
            {
                var supplier = new Supplier(supplierId);
                await supplier.CreateAcceptedLink(parentId, _publisherStub);

                await supplier.RemoveLink(parentId, _publisherStub);

                await Assert.ThrowsAsync <NotLinkedWithGivenParent>(() => supplier.RemoveLink(parentId, _publisherStub));
            }
 public AcceptLinkCommand(int subsidiaryId, int parentId)
 {
     SubsidiaryId = new SupplierId(subsidiaryId);
     ParentId     = new SupplierId(parentId);
 }
Exemplo n.º 6
0
 public void CanCreateSupplierWithCorrectArguments(SupplierId supplierId, SupplierId parentId, RelationshipStatus relationshipStatus, List <SupplierId> children)
 => new Supplier(supplierId, parentId, relationshipStatus, children);
Exemplo n.º 7
0
 public void CannotCreateSupplierWithChildrenAsNull(SupplierId subsidiaryId, SupplierId parentId, RelationshipStatus relationshipStatus)
 => Assert.Throws <InconsistentState>(() => new Supplier(subsidiaryId, parentId, relationshipStatus, children: null));
Exemplo n.º 8
0
 public void CannotCreateSupplierWithRelationshipStatusButWithoutParent(SupplierId subsidiaryId, RelationshipStatus relationshipStatus, List <SupplierId> children)
 => Assert.Throws <InconsistentState>(() => new Supplier(subsidiaryId, parentId: None, relationshipStatus, children));
Exemplo n.º 9
0
 public void CannotCreateSupplierWithParentAsChild(SupplierId subsidiaryId, SupplierId parentId, RelationshipStatus relationshipStatus)
 => Assert.Throws <InconsistentState>(() => new Supplier(subsidiaryId, parentId, relationshipStatus, new List <SupplierId> {
     parentId
 }));
Exemplo n.º 10
0
 public void CannotCreateSupplierWithItselfAsChild(SupplierId subsidiaryId)
 => Assert.Throws <InconsistentState>(() => new Supplier(subsidiaryId, new List <SupplierId> {
     subsidiaryId
 }));
Exemplo n.º 11
0
 public LinkRemoved(SupplierId supplierId, SupplierId parentId)
 {
     SubsidiaryId = supplierId;
     ParentId     = parentId;
 }
Exemplo n.º 12
0
 //METHOD WHICH RETURNS STRING
 public string PackProdSupplierToString()
 {
     return(Product + "," + ProductId.ToString() + "," + Supplier + "," + SupplierId.ToString() + ","
            + Prod_SupplierID.ToString());
 }