public void Add_Does_Not_Replace_Existing_Attributes() { var attribute1 = new TestDotAttribute(); var attribute2 = new TestDotAttribute(); var collection = new AttributeCollection(); collection.AddAttribute(attribute1); Assert.AreEqual(collection.CurrentAttributes.Count, 1); Assert.AreSame(collection.CurrentAttributes[0], attribute1); collection.AddAttribute(attribute2); Assert.AreEqual(collection.CurrentAttributes.Count, 1); Assert.AreSame(collection.CurrentAttributes[0], attribute1); }
public void Add_Adds_Attribute_To_Collection() { var attribute1 = MockRepository.GenerateMock<IDotAttribute>(); var attribute2 = MockRepository.GenerateMock<OtherDotAttribute>(); var collection = new AttributeCollection(); collection.AddAttribute(attribute1); Assert.AreEqual(collection.CurrentAttributes.Count, 1); Assert.AreSame(collection.CurrentAttributes[0], attribute1); collection.AddAttribute(attribute2); Assert.AreEqual(collection.CurrentAttributes.Count, 2); Assert.AreSame(collection.CurrentAttributes[0], attribute1); Assert.AreSame(collection.CurrentAttributes[1], attribute2); }
public void ToDot_Generates_Dot_For_All_Attributes() { var attribute1 = MockRepository.GenerateMock<IDotAttribute>(); var attribute2 = MockRepository.GenerateMock<OtherDotAttribute>(); var collection = new AttributeCollection(); collection.AddAttribute(attribute1); collection.AddAttribute(attribute2); attribute1.Expect(x => x.ToDot()).Return("label=\"some label\""); attribute2.Expect(x => x.ToDot()).Return("fontcolor=darkgreen"); string dot = collection.ToDot(); attribute1.VerifyAllExpectations(); attribute2.VerifyAllExpectations(); Assert.AreEqual(dot, "[label=\"some label\", fontcolor=darkgreen]"); }
public void ToDot_Generates_Dot_Correctly_With_Only_One_Attribute() { var attribute = MockRepository.GenerateMock<IDotAttribute>(); var collection = new AttributeCollection(); collection.AddAttribute(attribute); attribute.Expect(x => x.ToDot()).Return("label=\"some label\""); string dot = collection.ToDot(); attribute.VerifyAllExpectations(); Assert.AreEqual(dot, "[label=\"some label\"]"); }