public void VerifyThatContainersCantBeAddedAfterEngineeringModel() { ElementDefinition elementDefinition; var elementDefinitionId = Guid.NewGuid(); var iterationId = Guid.NewGuid(); var engineeringModelId = Guid.NewGuid(); elementDefinition = new ElementDefinition(elementDefinitionId, 1); elementDefinition.AddContainer(ClassKind.Iteration, iterationId); elementDefinition.AddContainer(ClassKind.EngineeringModel, engineeringModelId); Assert.Throws <InvalidOperationException>(() => elementDefinition.AddContainer(ClassKind.Person, Guid.NewGuid())); }
public void VerifyThatTopContainerRouteIsCorrect() { // iteration thing ElementDefinition elementDefinition; var elementDefinitionId = Guid.NewGuid(); var iterationId = Guid.NewGuid(); var engineeringModelId = Guid.NewGuid(); elementDefinition = new ElementDefinition(elementDefinitionId, 1); elementDefinition.AddContainer(ClassKind.Iteration, iterationId); elementDefinition.AddContainer(ClassKind.EngineeringModel, engineeringModelId); Assert.AreEqual(string.Format("/EngineeringModel/{0}/iteration/{1}", engineeringModelId, iterationId), elementDefinition.GetTopContainerRoute()); // engineering model thing Book book; Section section; book = new Book(Guid.NewGuid(), 1); book.AddContainer(ClassKind.EngineeringModel, engineeringModelId); section = new Section(Guid.NewGuid(), 1); section.AddContainer(ClassKind.Book, book.Iid); section.AddContainer(ClassKind.EngineeringModel, engineeringModelId); Assert.AreEqual($"/EngineeringModel/{engineeringModelId}", book.GetTopContainerRoute()); Assert.AreEqual($"/EngineeringModel/{engineeringModelId}", section.GetTopContainerRoute()); EngineeringModel enModel; enModel = new EngineeringModel(Guid.NewGuid(), 1); Assert.AreEqual($"/EngineeringModel/{enModel.Iid}", enModel.GetTopContainerRoute()); // site directory thing BooleanParameterType booleanParameterType; var booleanParameterTypeId = Guid.NewGuid(); var siteReferenceDataLibraryId = Guid.NewGuid(); var siteDirectoryId = Guid.NewGuid(); var siteDirectory = new SiteDirectory(siteDirectoryId, 1); booleanParameterType = new BooleanParameterType(booleanParameterTypeId, 1); booleanParameterType.AddContainer(ClassKind.SiteReferenceDataLibrary, siteReferenceDataLibraryId); booleanParameterType.AddContainer(ClassKind.SiteDirectory, siteDirectoryId); Assert.That(booleanParameterType.GetTopContainerRoute(), Is.EqualTo($"/SiteDirectory/{siteDirectoryId}")); Assert.That(siteDirectory.GetTopContainerRoute(), Is.EqualTo($"/SiteDirectory/{siteDirectoryId}")); }