public void SaveGraph_LoadGraph_ReturnsEqualGraph( int obstaclePercent, int[] graphParams) { graphAssembler = new GraphAssemble( vertexFactory, coordinateFactory, graphFactory, costFactory, radarFactory); IGraph deserialized; var graph = graphAssembler.AssembleGraph( obstaclePercent, graphParams); var serializer = new GraphSerializer( formatter, vertexConverter, graphFactory); using (var stream = new MemoryStream()) { serializer.SaveGraph(graph, stream); stream.Seek(0, SeekOrigin.Begin); deserialized = serializer.LoadGraph(stream); } Assert.AreEqual(graph, deserialized); Assert.AreNotSame(graph, deserialized); }
public GraphAssemblerTests() { coordinateFactory = new TestCoordinateFactory(); vertexFactory = new TestVertexFactory(); costFactory = new TestCostFactory(); graphFactory = new TestGraphFactory(); radarFactory = new CoordinateAroundRadarFactory(); graphAssembler = new GraphAssemble(vertexFactory, coordinateFactory, graphFactory, costFactory, radarFactory); }
public MainViewModel( BaseGraphFieldFactory fieldFactory, IVertexEventHolder eventHolder, IGraphSerializer graphSerializer, IGraphAssemble graphFactory, IPathInput pathInput, IAssembleClasses assembleClasses, Logs log) : base(fieldFactory, eventHolder, graphSerializer, graphFactory, pathInput, assembleClasses, log) { }
public AlgorithmTest() { radarFactory = new CoordinateAroundRadarFactory(); graphFactory = new TestGraphFactory(); vertexFactory = new TestVertexFactory(); costFactory = new TestVertexCostFactory(); coordinateFactory = new TestCoordinateFactory(); graphAssemble = new GraphAssemble(vertexFactory, coordinateFactory, graphFactory, costFactory, radarFactory); testAssemble = new TestGraphAssemble(graphAssemble); }
protected MainModel(BaseGraphFieldFactory fieldFactory, IVertexEventHolder eventHolder, IGraphSerializer graphSerializer, IGraphAssemble graphAssembler, IPathInput pathInput, IAssembleClasses assembleClasses, ILog log) { this.eventHolder = eventHolder; serializer = graphSerializer; graphSerializer.OnExceptionCaught += log.Warn; this.fieldFactory = fieldFactory; this.graphAssembler = graphAssembler; this.pathInput = pathInput; this.assembleClasses = assembleClasses; this.log = log; Graph = new NullGraph(); }
public GraphPathTests() { graphAssemble = new TestGraph2DAssemble(); expectedPraphPathCoordinates = new ICoordinate[] { new TestCoordinate(0, 0), //1 new TestCoordinate(0, 1), //5 new TestCoordinate(1, 2), //8 new TestCoordinate(1, 3), //1 new TestCoordinate(2, 4), //3 new TestCoordinate(3, 5), //2 new TestCoordinate(3, 6), //1 new TestCoordinate(4, 7) //5 }; graph = graphAssemble.AssembleGraph(0); var source = graph[expectedPraphPathCoordinates.First()]; var target = graph[expectedPraphPathCoordinates.Last()]; endPoints = new EndPoints(source, target); parentVertices = new ParentVertices(); FormParentVertices(parentVertices); }
public void SaveGraph_LoadGraph_NotSerializableCoordinate_ThrowsCantSerializeGraphException( int obstaclePercent, int[] graphParams) { graphAssembler = new GraphAssemble( vertexFactory, notSerializableCoordinateFactory, graphFactory, costFactory, radarFactory); var graph = graphAssembler.AssembleGraph( obstaclePercent, graphParams); var serializer = new GraphSerializer( formatter, vertexConverter, graphFactory); Assert.Throws <CantSerializeGraphException>(() => { using var stream = new MemoryStream(); serializer.SaveGraph(graph, stream); stream.Seek(0, SeekOrigin.Begin); serializer.LoadGraph(stream); }); }
public GraphCreatingViewModel(ILog log, IMainModel model, IGraphAssemble graphFactory) : base(log, model, graphFactory) { }
protected GraphCreatingModel(ILog log, IMainModel model, IGraphAssemble graphFactory) { this.model = model; this.graphFactory = graphFactory; this.log = log; }
public TestGraphAssemble(IGraphAssemble graphAssemble) { this.graphAssemble = graphAssemble; }
public GraphCreatingViewModel(ILog log, IMainModel model, IGraphAssemble graphFactory) : base(log, model, graphFactory) { ConfirmCreateGraphCommand = new RelayCommand(ExecuteConfirmCreateGraphCommand); CancelCreateGraphCommand = new RelayCommand(obj => CloseWindow()); }