Ejemplo n.º 1
0
 public static PairwiseTestMatrix LoadFromXmlFile(string filename)
 {
     using (StreamReader sr = new StreamReader(filename))
     {
         return((PairwiseTestMatrix)MatrixSerializer.Deserialize(sr));
     }
 }
Ejemplo n.º 2
0
 public IXPathNavigable CreateXPathNavigable()
 {
     using (MemoryStream ms = new MemoryStream())
     {
         MatrixSerializer.Serialize(ms, this, xsn);
         ms.Seek(0, SeekOrigin.Begin);
         return(new XPathDocument(ms));
     }
 }
Ejemplo n.º 3
0
        public void TestSerialization()
        {
            string filePath = @"D:\github\repo\epam\tasks\task1\MatrixCore\MatrixTests\TestFiles\test.json";

            MatrixSerializer.Serialize(matrix, filePath);
            Matrix deserialized = MatrixSerializer.Deserialize(filePath);

            Assert.AreEqual(matrix, deserialized);
        }
Ejemplo n.º 4
0
        public void Serialize_Test()
        {
            // Arrange
            var example = new Matrix(new double[, ] {
                { 1, 2, 3 }, { 4, 5, 6 }
            });
            // Act
            var result = new MatrixSerializer().Serialize(example);

            //Assert
            Assert.AreEqual("1 2 3\r\n4 5 6\r\n", result);
        }
Ejemplo n.º 5
0
        public XmlDocument CreateXmlDocument()
        {
            XmlDocument xd = new XmlDocument();

            using (MemoryStream ms = new MemoryStream())
            {
                MatrixSerializer.Serialize(ms, this, xsn);
                ms.Seek(0, SeekOrigin.Begin);
                xd.Load(ms);
            }

            return(xd);
        }
Ejemplo n.º 6
0
 public void WriteXmlTo(XmlTextWriter writer)
 {
     MatrixSerializer.Serialize(writer, this, xsn);
 }