예제 #1
0
 public static PairwiseTestMatrix LoadFromXmlFile(string filename)
 {
     using (StreamReader sr = new StreamReader(filename))
     {
         return((PairwiseTestMatrix)MatrixSerializer.Deserialize(sr));
     }
 }
예제 #2
0
 public IXPathNavigable CreateXPathNavigable()
 {
     using (MemoryStream ms = new MemoryStream())
     {
         MatrixSerializer.Serialize(ms, this, xsn);
         ms.Seek(0, SeekOrigin.Begin);
         return(new XPathDocument(ms));
     }
 }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #6
0
 public void WriteXmlTo(XmlTextWriter writer)
 {
     MatrixSerializer.Serialize(writer, this, xsn);
 }