예제 #1
0
        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]");
        }
예제 #2
0
 public void ToDot_With_No_Elements_Should_Return_Empty_String() {
     var collection = new AttributeCollection();
     Assert.AreEqual(collection.ToDot(), String.Empty);
 }
예제 #3
0
        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\"]");
        }