public void ActionCtorOk() { var actual = new System.Collections.Generic.List <System.Collections.Generic.Stack <TypeVisit> >(); var visitor = new StaticVisitor(stack => actual.Add(stack.Clone())); visitor.Visit(typeof(DataStructure)); Assert.IsTrue(actual.Count == 1); Assert.IsTrue(actual[0].CurrentType() == typeof(DataStructure)); Assert.IsTrue(actual[0].CurrentVisit() is InitialTypeTypeVisit); }
public void BasicOk() { var actual = new System.Collections.Generic.List <System.Collections.Generic.Stack <TypeVisit> >(); var visitor = new StaticVisitor(actual); visitor.Visit(typeof(DataStructure)); Assert.IsTrue(actual.Count == 2); Assert.IsTrue(actual[0].CurrentType() == typeof(DataStructure)); Assert.IsTrue(actual[0].CurrentVisit() is InitialTypeTypeVisit); Assert.IsTrue(actual[1].CurrentType() == typeof(PropertyObject)); Assert.IsTrue(actual[1].CurrentVisit() is PropertyTypeVisit); Assert.IsTrue(((PropertyTypeVisit)actual[1].CurrentVisit()).PropertyName == "Property"); }
public void ActionCtorWithConfigurationOk() { var configurationCalled = false; var configuration = new StaticVisitorConfiguration { TypeCanBeVisited = x => { configurationCalled = true; return(false); } }; var actual = new System.Collections.Generic.List <System.Collections.Generic.Stack <TypeVisit> >(); var visitor = new StaticVisitor(stack => actual.Add(stack.Clone()), configuration); visitor.Visit(typeof(DataStructure)); Assert.IsTrue(configurationCalled); }