Esempio n. 1
0
        public static byte[] GetSerializedVariant()
        {
            var graph1 = DirectedGraph.CreateEmpty(7);

            graph1.AddEdge(new DirectedEdge(graph1.Vertices[0], graph1.Vertices[5]));
            graph1.AddEdge(new DirectedEdge(graph1.Vertices[1], graph1.Vertices[0]));
            graph1.AddEdge(new DirectedEdge(graph1.Vertices[1], graph1.Vertices[5]));
            graph1.AddEdge(new DirectedEdge(graph1.Vertices[2], graph1.Vertices[1]));
            graph1.AddEdge(new DirectedEdge(graph1.Vertices[2], graph1.Vertices[5]));
            graph1.AddEdge(new DirectedEdge(graph1.Vertices[3], graph1.Vertices[4]));
            graph1.AddEdge(new DirectedEdge(graph1.Vertices[4], graph1.Vertices[2]));
            graph1.AddEdge(new DirectedEdge(graph1.Vertices[4], graph1.Vertices[3]));
            graph1.AddEdge(new DirectedEdge(graph1.Vertices[5], graph1.Vertices[6]));
            graph1.AddEdge(new DirectedEdge(graph1.Vertices[6], graph1.Vertices[4]));

            var graph2 = DirectedGraph.CreateEmpty(7);

            graph2.AddEdge(new DirectedEdge(graph2.Vertices[0], graph2.Vertices[5]));
            graph2.AddEdge(new DirectedEdge(graph2.Vertices[1], graph2.Vertices[0]));
            graph2.AddEdge(new DirectedEdge(graph2.Vertices[1], graph2.Vertices[5]));
            graph2.AddEdge(new DirectedEdge(graph2.Vertices[2], graph2.Vertices[1]));
            graph2.AddEdge(new DirectedEdge(graph2.Vertices[2], graph2.Vertices[5]));
            graph2.AddEdge(new DirectedEdge(graph2.Vertices[3], graph2.Vertices[4]));
            graph2.AddEdge(new DirectedEdge(graph2.Vertices[4], graph2.Vertices[2]));
            graph2.AddEdge(new DirectedEdge(graph2.Vertices[4], graph2.Vertices[3]));
            graph2.AddEdge(new DirectedEdge(graph2.Vertices[5], graph2.Vertices[6]));
            graph2.AddEdge(new DirectedEdge(graph2.Vertices[6], graph2.Vertices[4]));

            return(VariantSerializer.Serialize(new IGraph[]
            {
                graph1,
                graph2
            }));
        }
Esempio n. 2
0
        /// <summary> Сгенерировать отладочный вариант </summary>
        protected override TaskVariantDto GetDebugVariant()
        {
            var debugGraph1 = UndirectedGraph.CreateEmpty(7);

            debugGraph1.AddEdge(new UndirectedEdge(debugGraph1.Vertices[0], debugGraph1.Vertices[1]));
            debugGraph1.AddEdge(new UndirectedEdge(debugGraph1.Vertices[0], debugGraph1.Vertices[6]));
            debugGraph1.AddEdge(new UndirectedEdge(debugGraph1.Vertices[0], debugGraph1.Vertices[2]));
            var debugGraph2 = UndirectedGraph.CreateEmpty(7);

            debugGraph2.AddEdge(new UndirectedEdge(debugGraph2.Vertices[0], debugGraph2.Vertices[1]));
            debugGraph2.AddEdge(new UndirectedEdge(debugGraph2.Vertices[0], debugGraph2.Vertices[6]));
            debugGraph2.AddEdge(new UndirectedEdge(debugGraph2.Vertices[0], debugGraph2.Vertices[2]));
            var serializedVariant = VariantSerializer.Serialize(new IGraph[]
            {
                debugGraph1,
                debugGraph2
            });

            return(new TaskVariantDto
            {
                Data = serializedVariant,
                GeneratorVersion = "1.0",
                Number = "Debug",
                Version = 1
            });
        }
Esempio n. 3
0
        public void TestSerializeVariantDto()
        {
            var graphs = CreateGraphs().ToArray();
            var dto    = VariantSerializer.Serialize(graphs);

            CollectionAssert.IsNotEmpty(dto);

            var deserializedGraphs = VariantSerializer.Deserialize(dto);

            Assert.That(deserializedGraphs.Count() == 2);
        }
        /// <summary> Сгенерировать отладочный вариант </summary>
        protected override TaskVariantDto GetDebugVariant()
        {
            var debugGraph = DirectedGraph.CreateEmpty(7);

            debugGraph.AddEdge(new DirectedEdge(debugGraph.Vertices[0], debugGraph.Vertices[5]));
            debugGraph.AddEdge(new DirectedEdge(debugGraph.Vertices[1], debugGraph.Vertices[0]));
            debugGraph.AddEdge(new DirectedEdge(debugGraph.Vertices[1], debugGraph.Vertices[5]));
            debugGraph.AddEdge(new DirectedEdge(debugGraph.Vertices[2], debugGraph.Vertices[1]));
            debugGraph.AddEdge(new DirectedEdge(debugGraph.Vertices[2], debugGraph.Vertices[5]));
            debugGraph.AddEdge(new DirectedEdge(debugGraph.Vertices[3], debugGraph.Vertices[4]));
            debugGraph.AddEdge(new DirectedEdge(debugGraph.Vertices[4], debugGraph.Vertices[2]));
            debugGraph.AddEdge(new DirectedEdge(debugGraph.Vertices[4], debugGraph.Vertices[3]));
            debugGraph.AddEdge(new DirectedEdge(debugGraph.Vertices[5], debugGraph.Vertices[6]));
            debugGraph.AddEdge(new DirectedEdge(debugGraph.Vertices[6], debugGraph.Vertices[4]));
            var serializedGraph = VariantSerializer.Serialize(new IGraph[] { debugGraph });

            return(new TaskVariantDto
            {
                Data = serializedGraph,
                GeneratorVersion = "1.0",
                Number = "Debug",
                Version = 1
            });
        }