public void RejectsAComponentWithAnIllegalAlias() { TestDiagram.From(_memoryStream) .Component("irrelevant").WithAlias("ill[]egal").WithStereoTypes("Irrelevant.*") .Write(); IllegalDiagramException exception = Assert.Throws <IllegalDiagramException>(() => CreateDiagram(_memoryStream)); Assert.Contains("Alias 'ill[]egal' should not contain character(s): '[' or ']' or '\"'", exception.Message); }
public void ThrowsExceptionWithComponentsThatAreNotYetDefined() { TestDiagram.From(_memoryStream) .DependencyFrom("[NotYetDefined]").To("[AlsoNotYetDefined]") .Write(); IllegalDiagramException exception = Assert.Throws <IllegalDiagramException>(() => CreateDiagram(_memoryStream)); Assert.Contains("There is no Component with name or alias = 'NotYetDefined'", exception.Message); Assert.Contains("Components must be specified separately from dependencies", exception.Message); }
public void ThrowsExceptionWithComponentsWithoutStereotypes() { TestDiagram.From(_memoryStream) .RawLine("[componentWithoutStereotype]") .Write(); IllegalDiagramException exception = Assert.Throws <IllegalDiagramException>(() => CreateDiagram(_memoryStream)); Assert.Contains("componentWithoutStereotype", exception.Message); Assert.Contains("at least one stereotype specifying the namespace identifier (<<.*>>)", exception.Message); }
public void RejectsDuplicateStereotype() { using (MemoryStream memoryStream = new MemoryStream()) { TestDiagram.From(memoryStream) .Component("first").WithStereoTypes(".*.Identical.*") .Component("second").WithStereoTypes(".*.Identical.*") .Write(); Class classContainedInTwoComponents = Architecture.GetClassOfType(typeof(ClassInFooAndBarNamespace)); IllegalDiagramException exception = Assert.Throws <IllegalDiagramException>(() => CreateAssociation(memoryStream)); Assert.Equal("Stereotype '.*.Identical.*' should be unique", exception.Message); } }