/// <summary> /// Compute the write-permission for a <see cref="IOwnedThing"/> contained in an <see cref="EngineeringModel"/> /// </summary> /// <param name="ownedThing">The <see cref="IOwnedThing"/> contained by an <see cref="EngineeringModel"/></param> /// <returns>True if write permission is granted</returns> private bool CanWriteIfParticipantOwned(IOwnedThing ownedThing) { var thing = (Thing)ownedThing; if (thing.Container is EngineeringModel currentModel) { return(this.Session.OpenIterations.Where(x => x.Key.Container == currentModel).Select(x => x.Value).Any()); } //Check if the ownedThing domain is contained in the participant domains return(this.TryGetThingParticipant(thing, out var participant) && participant.Domain.Contains(ownedThing.Owner)); }
private void AssertThingHasExpectedOwner(DomainOfExpertise oldOwner, DomainOfExpertise newOwner, IOwnedThing thing) { Assert.IsNotNull(thing); Assert.AreNotSame(oldOwner, thing.Owner); Assert.AreSame(newOwner, thing.Owner); }