public void ValidateMatrixFactoryParse() { denseMatObj = GetDenseMatrix(); MatrixFactory<String, String, Double> mfObj = MatrixFactory<String, String, Double>.GetInstance(); ParallelOptions poObj = new ParallelOptions(); TryParseMatrixDelegate<string, string, double> a = new TryParseMatrixDelegate<string, string, double>(this.TryParseMatrix); mfObj.RegisterMatrixParser(a); // Writes the text file denseMatObj.WritePaddedDouble(Constants.FastQTempTxtFileName, poObj); Matrix<string, string, double> newMatObj = mfObj.Parse(Constants.FastQTempTxtFileName, double.NaN, poObj); Assert.AreEqual(denseMatObj.RowCount, newMatObj.RowCount); Assert.AreEqual(denseMatObj.RowKeys.Count, newMatObj.RowKeys.Count); Assert.AreEqual(denseMatObj.ColCount, newMatObj.ColCount); Assert.AreEqual(denseMatObj.ColKeys.Count, newMatObj.ColKeys.Count); Assert.AreEqual(denseMatObj.Values.Count(), newMatObj.Values.Count()); ApplicationLog.WriteLine( "MatrixFactory BVT : Successfully validated Parse() method"); }
public void ValidateMatrixFactoryParse() { _denseMatObj = GetDenseMatrix(); MatrixFactory <String, String, Double> mfObj = MatrixFactory <String, String, Double> .GetInstance(); ParallelOptions poObj = new ParallelOptions(); TryParseMatrixDelegate <string, string, double> a = new TryParseMatrixDelegate <string, string, double>(this.TryParseMatrix); mfObj.RegisterMatrixParser(a); // Writes the text file _denseMatObj.WritePaddedDouble(Constants.FastQTempTxtFileName, poObj); Matrix <string, string, double> newMatObj = mfObj.Parse(Constants.FastQTempTxtFileName, double.NaN, poObj); Assert.AreEqual(_denseMatObj.RowCount, newMatObj.RowCount); Assert.AreEqual(_denseMatObj.RowKeys.Count, newMatObj.RowKeys.Count); Assert.AreEqual(_denseMatObj.ColCount, newMatObj.ColCount); Assert.AreEqual(_denseMatObj.ColKeys.Count, newMatObj.ColKeys.Count); Assert.AreEqual(_denseMatObj.Values.Count(), newMatObj.Values.Count()); Console.WriteLine( "MatrixFactory BVT : Successfully validated Parse() method"); ApplicationLog.WriteLine( "MatrixFactory BVT : Successfully validated Parse() method"); }
public void ValidateMatrixFactoryRegisterMatrixParser() { MatrixFactory<String, String, Double> mfactObj = MatrixFactory<String, String, Double>.GetInstance(); TryParseMatrixDelegate<string, string, double> tryParseDelObj = new TryParseMatrixDelegate<string, string, double>(TryParseMatrix); mfactObj.RegisterMatrixParser(tryParseDelObj); Assert.IsTrue(true, "No exceptions were thrown on running RegisterMatrixParser() method"); }
public void ValidateMatrixFactoryRegisterMatrixParser() { MatrixFactory <String, String, Double> mfactObj = MatrixFactory <String, String, Double> .GetInstance(); TryParseMatrixDelegate <string, string, double> tryParseDelObj = new TryParseMatrixDelegate <string, string, double>(TryParseMatrix); mfactObj.RegisterMatrixParser(tryParseDelObj); Assert.IsTrue(true, "No exceptions were thrown on running RegisterMatrixParser() method"); }
/// <summary> /// Adds the specificed parsing function to the MatrixFactory /// </summary> /// <param name="tryParseMatrixDelegate">The function to add.</param> public void RegisterMatrixParser(TryParseMatrixDelegate <TRowKey, TColKey, TValue> tryParseMatrixDelegate) { _registeredParsers.Add(tryParseMatrixDelegate); }
/// </summary> /// <param name="tryParseMatrixDelegate">The function to add.</param> public void RegisterMatrixParser(TryParseMatrixDelegate <TRowKey, TColKey, TValue> tryParseMatrixDelegate) { /// <summary> /// Adds the specificed parsing function to the MatrixFactory _registeredParsers.Add(tryParseMatrixDelegate); }