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)); }
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)); }
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)); }
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); }
public void CanCreateSupplierWithCorrectArguments(SupplierId supplierId, SupplierId parentId, RelationshipStatus relationshipStatus, List <SupplierId> children) => new Supplier(supplierId, parentId, relationshipStatus, children);
public void CannotCreateSupplierWithChildrenAsNull(SupplierId subsidiaryId, SupplierId parentId, RelationshipStatus relationshipStatus) => Assert.Throws <InconsistentState>(() => new Supplier(subsidiaryId, parentId, relationshipStatus, children: null));
public void CannotCreateSupplierWithRelationshipStatusButWithoutParent(SupplierId subsidiaryId, RelationshipStatus relationshipStatus, List <SupplierId> children) => Assert.Throws <InconsistentState>(() => new Supplier(subsidiaryId, parentId: None, relationshipStatus, children));
public void CannotCreateSupplierWithParentAsChild(SupplierId subsidiaryId, SupplierId parentId, RelationshipStatus relationshipStatus) => Assert.Throws <InconsistentState>(() => new Supplier(subsidiaryId, parentId, relationshipStatus, new List <SupplierId> { parentId }));
public void CannotCreateSupplierWithItselfAsChild(SupplierId subsidiaryId) => Assert.Throws <InconsistentState>(() => new Supplier(subsidiaryId, new List <SupplierId> { subsidiaryId }));
public LinkRemoved(SupplierId supplierId, SupplierId parentId) { SubsidiaryId = supplierId; ParentId = parentId; }
//METHOD WHICH RETURNS STRING public string PackProdSupplierToString() { return(Product + "," + ProductId.ToString() + "," + Supplier + "," + SupplierId.ToString() + "," + Prod_SupplierID.ToString()); }