예제 #1
0
        public int GetEjendom()
        {
            Console.WriteLine("\n GetEjendom() test:\n---------------------------------------------");

            EvalueTest <EvalueBEC> .TryCollectData(testPathOld, ref localOldFile, 1, true);

            // It just uses the storeproperty on its own List anyway,
            // might as well use the EvalueStorage class.
            // Right now we're checking for a KeyNotFound.
            Evalue fest = localNewFile.GetProperty(localOldFile.Evalues[0].KomNr,
                                                   localOldFile.Evalues[0].EjdNr);

            Console.WriteLine("Fest == null: {0}\n", fest == null);

            // Fill the actual table
            EvalueTest <EvalueBEC> .TryCollectData(testPathNew, ref localNewFile, 2, true);

            fest = localNewFile.GetProperty(localOldFile.Evalues[0].KomNr,
                                            localOldFile.Evalues[0].EjdNr);

            Console.WriteLine(fest);

            Console.WriteLine("---------------------------------------------\n");

            return(0);
        }
예제 #2
0
        public int PutGetProperty()
        {
            Console.WriteLine("\nPutProperty() and GetProperty() Test:\n---------------------------------------------");

            EvalueStorage evalStore = new EvalueStorage();

            EvalueBEC testProp = new EvalueBEC
            {
                KomNr = 253,
                EjdNr = 26510
            };


            int ret = evalStore.PutProperty(testProp);

            Console.WriteLine("Put-test. Return == 0: {0}", ret == 0);

            Evalue test = evalStore.GetProperty(253, 26510);

            Console.WriteLine("Get-test. Return == testProp: {0}", test == testProp);

            int length = evalStore.Length();

            Console.WriteLine("Length() test. Return == 1: {0}", length == 1);

            Console.WriteLine("\nWith an actual value...");

            test = new EvalueBEC();
            test.Init("69;69;2018-02-09T16:30:30.033;2012-05-29;1;26510;253;3117000;2018-02-01;2600000;2010-02-12;0;;;0;0;2532179017");

            ret = evalStore.PutProperty(test);
            Console.WriteLine("Put-test. Return == 0: {0}", ret == 0);

            Evalue testGet = evalStore.GetProperty(253, 26510);

            Console.WriteLine("Get-test. Return == test value: {0}", testGet == test);
            Console.WriteLine("\nDouble-check:\n{0}\n{1}", test.ToCsv(), testGet.ToCsv());

            length = evalStore.Length();
            // We expect this to return -1, since we now have one element in the StoreProperty
            // and two in the Evalues list of evalStore. Need to investigate how to handle this.
            // Can there be two properties with the same komnr and ejdnr?
            Console.WriteLine("\nLength() error test. Return == -1: {0}", length == -1);
            Console.WriteLine("Double-check: Length = {0}", length);

            Console.WriteLine("\nActual null-test Get...");
            Console.WriteLine("Get-test with no result: {0}",
                              evalStore.GetProperty(100, 100) == null);

            Console.WriteLine("---------------------------------------------\n");

            return(0);
        }