public void ParseLineTestCase() { //given SimpleCubeDescriptionFactory cf = new SimpleCubeDescriptionFactory(); //when SimpleCubeDescription scd = cf .parseLine("Counter table name: DMAGGR_SMACS") .parseLine("OLAP cube source: VI_DMAGGR_SMACS ") .parseLine("OLAP cube Name: \t SMACS") .parseLine("Measures COUNT") .parseLine("\tTOTAL_VOLUME") .parseLine("\tUPLINK") .parseLine("\tDOWNLINK") .parseLine("Dimensions START_TIME") .parseLine("SUBSCRIBER_TYPE") .parseLine(" TRAFFIC_CATEGORY") .parseLine(" ROAMING OPERATOR") .parseLine(" ROAMING_ZONE") .parseLine(" NETWORK ELEMENT") .parseLine("Generate") .cubeDescriptionList[0]; //then Assert.AreEqual("DMAGGR_SMACS", scd.counterTableName); Assert.AreEqual("SMACS", scd.olapCubeName); Assert.AreEqual("VI_DMAGGR_SMACS", scd.olapCubeSource); Assert.AreEqual(4, scd.measures.Length, string.Join(",", scd.measures)); Assert.AreEqual(5, scd.dimensions.Length, string.Join(",", scd.dimensions)); Assert.IsTrue(Array.Exists(scd.dimensions, delegate(string s){ return(s.Equals("NETWORK_ELEMENT")); })); //System.Console.WriteLine (); }
public void ParseFileTestCase() { //given String filePath = "CubeDescriptor.txt"; StreamReader streamReader = new StreamReader(filePath); SimpleCubeDescriptionFactory cf = new SimpleCubeDescriptionFactory(); //when while (!streamReader.EndOfStream) { string text = streamReader.ReadLine(); cf.parseLine(text); } // streamReader.ReadToEnd(); //then streamReader.Close(); }