public int CompareProperties() { EvalueBEC Old = new EvalueBEC(); EvalueBEC New = new EvalueBEC(); string dataLineOld = "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"; string dataLineNew = "70;70;2018-03-09T16:30:32.333;2012-05-29;1;26510;253;3280000;2018-03-01;2600000;2010-02-12;0;;;0;0;2532179017"; Old.Init(dataLineOld); New.Init(dataLineNew); StatisticProperty statProp; Console.WriteLine("\nCompareProperties() Test:\n---------------------------------------------"); statProp = stat.CompareProperties(new EvalueBEC(), new EvalueBEC()); Console.WriteLine("With both values as new EvalueBEC(): {0}", statProp.ToCsv()); statProp = stat.CompareProperties(new EvalueBEC(), New); Console.WriteLine("With first value as new EvalueBEC(): {0}", statProp.ToCsv()); statProp = stat.CompareProperties(Old, new EvalueBEC()); Console.WriteLine("With second value as new EvalueBEC(): {0}", statProp.ToCsv()); statProp = stat.CompareProperties(Old, New); Console.WriteLine("With both values as actual values: {0}", statProp.ToCsv()); Console.WriteLine("---------------------------------------------\n"); return(0); }
public int Length() { EvalueStorage evalStore = new EvalueStorage(); Console.WriteLine("\nLength() Test:\n---------------------------------------------"); EvalueBEC test = new EvalueBEC() { KomNr = 253, EjdNr = 26510 }; EvalueBEC testTwo = new EvalueBEC() { KomNr = 250, EjdNr = 26510 }; evalStore.PutProperty(test); evalStore.PutProperty(testTwo); Console.WriteLine("Length = 2: {0}", evalStore.Length() == 2); Console.WriteLine("Double-check: {0}", evalStore.Length()); Console.WriteLine("---------------------------------------------\n"); return(0); }
public int Init() { EvalueBEC ejendomBECOld = new EvalueBEC(); EvalueBEC ejendomBECNew = new EvalueBEC(); bool oldHasEvalue = ejendomBECOld.ModelVaerdi > 0; bool newHasEvalue = ejendomBECNew.ModelVaerdi > 0; Console.WriteLine("Unitiated Old has evalue where evalue <= 0: " + ejendomBECOld.ModelVaerdi + ": " + !oldHasEvalue); Console.WriteLine("Unitiated New has evalue where evalue <= 0: " + ejendomBECNew.ModelVaerdi + ": " + !newHasEvalue); string dataLineOld = "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"; string dataLineNew = "70;70;2018-03-09T16:30:32.333;2012-05-29;1;26510;253;3280000;2018-03-01;2600000;2010-02-12;0;;;0;0;2532179017"; ejendomBECOld.Init(dataLineOld); ejendomBECNew.Init(dataLineNew); oldHasEvalue = ejendomBECOld.ModelVaerdi > 0; newHasEvalue = ejendomBECNew.ModelVaerdi > 0; Console.WriteLine("Old has evalue " + ejendomBECOld.ModelVaerdi + ": " + oldHasEvalue); Console.WriteLine("New has evalue " + ejendomBECNew.ModelVaerdi + ": " + newHasEvalue); return(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); }