public void EdgeStart() { var builder = new ReplacementRuleBuilder(); // don't start with edge Assert.ThrowsException <InvalidOperationException>(() => builder.PatternEdge <Edge>()); Assert.ThrowsException <InvalidOperationException>(() => builder.ReplacementEdge <Edge>()); Assert.ThrowsException <InvalidOperationException>(() => builder.MappedEdge <Edge>()); }
public void InvalidPatternVertexContinuation() { var builder = new ReplacementRuleBuilder(); // check impossible next states after adding pattern vertex builder.PatternVertex <Vertex>(); Assert.ThrowsException <InvalidOperationException>(() => builder.ReplacementEdge <Edge>()); Assert.ThrowsException <InvalidOperationException>(() => builder.MappedEdge <Edge>()); Assert.ThrowsException <InvalidOperationException>(() => builder.PatternVertex <Vertex>()); Assert.ThrowsException <InvalidOperationException>(() => builder.ReplacementVertex <Vertex>()); Assert.ThrowsException <InvalidOperationException>(() => builder.MappedVertex <Vertex>()); }
public void Control() { var builder = new ReplacementRuleBuilder(); // invalid operations in "start" state Assert.ThrowsException <InvalidOperationException>(() => builder.GetResult()); Assert.ThrowsException <InvalidOperationException>(() => builder.Continue()); builder.MappedVertex <Vertex>("test"); builder.MappedEdge <Edge>(); // can't get result if edge is unfinished Assert.ThrowsException <InvalidOperationException>(() => builder.GetResult()); builder.MappedVertex <Vertex>(); builder.PatternEdge <Edge>(); // can't get result if edge is unfinished Assert.ThrowsException <InvalidOperationException>(() => builder.GetResult()); // test continuing from end state builder.PatternVertex <Vertex>().GetResult(); builder.Continue("test"); builder.ReplacementEdge <Edge>(); // can't get result if edge is unfinished Assert.ThrowsException <InvalidOperationException>(() => builder.GetResult()); builder.ReplacementVertex <Vertex>(); // valid control: var rule = builder.GetResult(); builder.Continue(); builder.MoveToTag("test"); builder.GetResult(); builder.Reset(); Assert.IsTrue(rule.Pattern.Vertices.Count == 3); Assert.IsTrue(rule.Replacement.Vertices.Count == 3); Assert.IsTrue(rule.Mapping.Count == 2); }