Beispiel #1
0
        public void Read_TwoDimensionsSameMeasureGroup_DimensionsAreCorrectlyRead()
        {
            var header      = GetHeader();
            var testContent = header
                              + "\"p\";\"mg\";\"m1\";\"[m1]\";\"df\";\"d1\";\"[d1]\";\"h1\";\"[h1]\";\"l1\";\"[l1]\";\"0\";\"p1\";\"[p1]\"\r\n"
                              + "\"p\";\"mg\";\"m1\";\"[m1]\";\"df\";\"d2\";\"[d2]\";\"h2\";\"[h2]\";\"l2\";\"[l2]\";\"1\";\"p2\";\"[p2]\"\r\n"
            ;
            var testFilename = Path.Combine(DiskOnFile.GetDirectoryPath(), string.Format("ReadCSV-{0}.csv", MethodInfo.GetCurrentMethod()));

            if (File.Exists(testFilename))
            {
                File.Delete(testFilename);
            }
            File.AppendAllText(testFilename, testContent, Encoding.UTF8);

            //set the object to test
            var mcr      = new MetadataCsvReader(testFilename);
            var metadata = mcr.Read();

            //Assertion
            Assert.That(metadata.Perspectives["p"].MeasureGroups["mg"].LinkedDimensions.Count, Is.EqualTo(2));
            Assert.That(metadata.Perspectives["p"].MeasureGroups["mg"].LinkedDimensions["[d1]"].Caption, Is.EqualTo("d1"));
            Assert.That(metadata.Perspectives["p"].MeasureGroups["mg"].LinkedDimensions["[d2]"].Caption, Is.EqualTo("d2"));
            Assert.That(metadata.Perspectives["p"].MeasureGroups["mg"].LinkedDimensions["[d1]"].UniqueName, Is.EqualTo("[d1]"));
            Assert.That(metadata.Perspectives["p"].MeasureGroups["mg"].LinkedDimensions["[d2]"].UniqueName, Is.EqualTo("[d2]"));
        }
Beispiel #2
0
        public void Read_SimpleLine_PerspectiveIsCorrectlyRead()
        {
            var header       = GetHeader();
            var testContent  = header + "\"p\";\"mg\";\"m1\";\"[m1]\";\"df\";\"d\";\"[d]\";\"h1\";\"[h1]\";\"l1\";\"[l1]\";\"0\";\"p1\";\"[p1]\"\r\n";
            var testFilename = Path.Combine(DiskOnFile.GetDirectoryPath(), string.Format("ReadCSV-{0}.csv", MethodInfo.GetCurrentMethod()));

            if (File.Exists(testFilename))
            {
                File.Delete(testFilename);
            }
            File.AppendAllText(testFilename, testContent, Encoding.UTF8);

            //set the object to test
            var mcr      = new MetadataCsvReader(testFilename);
            var metadata = mcr.Read();

            //Assertion
            Assert.That(metadata.Perspectives.Count, Is.EqualTo(1));
            Assert.That(metadata.Perspectives["p"].Name, Is.EqualTo("p"));
        }
Beispiel #3
0
        public void Read_NoPropertyForTheLevel_PropertyCountIsEqualToZero()
        {
            var header       = GetHeader();
            var testContent  = header + "\"p\";\"mg\";\"m1\";\"[m1]\";\"df\";\"d\";\"[d]\";\"h1\";\"[h1]\";\"l1\";\"[l1]\";\"0\";\"\";\"\"\r\n";
            var testFilename = Path.Combine(DiskOnFile.GetDirectoryPath(), string.Format("ReadCSV-{0}.csv", MethodInfo.GetCurrentMethod()));

            if (File.Exists(testFilename))
            {
                File.Delete(testFilename);
            }
            File.AppendAllText(testFilename, testContent, Encoding.UTF8);

            //set the object to test
            var mcr      = new MetadataCsvReader(testFilename);
            var metadata = mcr.Read();

            var lev = metadata.Perspectives["p"].MeasureGroups["mg"].LinkedDimensions["[d]"].Hierarchies["[h1]"].Levels["[l1]"];

            //Assertion
            Assert.That(lev.Properties.Count, Is.EqualTo(0));
        }
Beispiel #4
0
        public void Read_TwoLinesWithPerspectivesCompletelyDifferent_PerspectiveAreCorrectlyRead()
        {
            var header      = GetHeader();
            var testContent = header
                              + "\"p1\";\"mg1\";\"m1\";\"[m1]\";\"df\";\"d1\";\"[d1]\";\"h1\";\"[h1]\";\"l1\";\"[l1]\";\"0\";\"p1\";\"[p1]\"\r\n"
                              + "\"p2\";\"mg2\";\"m2\";\"[m2]\";\"df\";\"d2\";\"[d2]\";\"h2\";\"[h2]\";\"l2\";\"[l2]\";\"0\";\"p2\";\"[p2]\"\r\n"
            ;
            var testFilename = Path.Combine(DiskOnFile.GetDirectoryPath(), string.Format("ReadCSV-{0}.csv", MethodInfo.GetCurrentMethod()));

            if (File.Exists(testFilename))
            {
                File.Delete(testFilename);
            }
            File.AppendAllText(testFilename, testContent, Encoding.UTF8);

            //set the object to test
            var mcr      = new MetadataCsvReader(testFilename);
            var metadata = mcr.Read();

            //Assertion
            Assert.That(metadata.Perspectives.Count, Is.EqualTo(2));
            Assert.That(metadata.Perspectives["p1"].Name, Is.EqualTo("p1"));
            Assert.That(metadata.Perspectives["p2"].Name, Is.EqualTo("p2"));
        }