public void Test_Authorise_KeepsAuthorisedReferences() { MockEntity entity = new MockEntity(); entity.ID = Guid.NewGuid(); MockPublicEntity publicEntity = new MockPublicEntity(); publicEntity.ID = Guid.NewGuid(); entity.PublicEntities = new MockPublicEntity[] { publicEntity }; AuthoriseReferencesStrategy.New(entity).Authorise(entity); Assert.AreEqual(1, entity.PublicEntities.Length, "Invalid number of public entities found."); }
public void Test_Authorise_RemovesUnauthorisedReferences() { MockEntity entity = new MockEntity(); entity.ID = Guid.NewGuid(); MockRestrictedEntity restrictedEntity = new MockRestrictedEntity(); restrictedEntity.ID = Guid.NewGuid(); entity.RestrictedEntities = new MockRestrictedEntity[] { restrictedEntity }; AuthoriseReferencesStrategy.New(entity).Authorise(entity); Assert.AreEqual(0, entity.RestrictedEntities.Length, "Invalid number of restricted entities found."); }