|
@@ -0,0 +1,114 @@
|
|
|
+using System;
|
|
|
+using System.IO;
|
|
|
+using GCHR.Model;
|
|
|
+using GCHR.Model.Mandant;
|
|
|
+using NUnit.Framework;
|
|
|
+
|
|
|
+namespace GCHR.Tests.Model
|
|
|
+{
|
|
|
+ [TestFixture]
|
|
|
+ public class KonfigurationTest
|
|
|
+ {
|
|
|
+ private static string PfadUndDatei(string dateiOhneEndung)
|
|
|
+ {
|
|
|
+ return Directory.GetCurrentDirectory() + "\\config\\" + dateiOhneEndung + ".xml";
|
|
|
+ }
|
|
|
+
|
|
|
+ private static Konfiguration KonfigurationLaden(string test)
|
|
|
+ {
|
|
|
+ return new Konfiguration(PfadUndDatei(test));
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ public void DateiMitStandardwertenAnlegen()
|
|
|
+ {
|
|
|
+ var datei = PfadUndDatei("standard");
|
|
|
+ File.Delete(datei);
|
|
|
+ var config = new Konfiguration(datei);
|
|
|
+
|
|
|
+ Assert.IsTrue(File.Exists(datei));
|
|
|
+ Assert.AreEqual("Autohaus", config.Haendler);
|
|
|
+ Assert.AreEqual(Mandanten.Opel, config.Mandantenname);
|
|
|
+ Assert.AreEqual(5, config.HerstellerKontenrahmenStellen);
|
|
|
+ Assert.AreEqual(5, config.HaendlerKontenrahmenStellen);
|
|
|
+ Assert.AreEqual("0", config.BilanzMarke);
|
|
|
+ Assert.AreEqual("07", config.BilanzBetrieb);
|
|
|
+ Assert.IsFalse(config.KontoOhneUebersetzungUebernehmen);
|
|
|
+ Assert.IsTrue(config.StatKontenImportieren);
|
|
|
+ Assert.AreEqual("01", config.Geschaeftsjahr);
|
|
|
+
|
|
|
+ Assert.AreEqual("00000000", config.Eurodatanummer);
|
|
|
+ Assert.AreEqual("000000", config.HaendlernummerBmCode);
|
|
|
+
|
|
|
+ Assert.AreEqual("DSN=O21;UID=sa;PWD=;", config.OdbcConnectionString);
|
|
|
+ Assert.AreEqual("deop00", config.Datenbank);
|
|
|
+
|
|
|
+ config.AktuellePeriode = new Periode("201104", true);
|
|
|
+
|
|
|
+ Assert.AreEqual("SELECT " + Environment.NewLine +
|
|
|
+ " T1.ACCT_NO," + Environment.NewLine +
|
|
|
+ " DEBIT_AMOUNT," + Environment.NewLine +
|
|
|
+ " CREDIT_AMOUNT," + Environment.NewLine +
|
|
|
+ " DEPARTMENT," + Environment.NewLine +
|
|
|
+ " BOOKKEEP_PERIOD," + Environment.NewLine +
|
|
|
+ " T2.TYPE_ACCTT" + Environment.NewLine +
|
|
|
+ "FROM deop00.dbo.ACCT_BALANCE T1" + Environment.NewLine +
|
|
|
+ "LEFT JOIN deop00.dbo.ACCOUNT_INFO T2 " + Environment.NewLine +
|
|
|
+ " ON T1.ACCT_NO=T2.ACCT_NR" + Environment.NewLine +
|
|
|
+ "WHERE " + Environment.NewLine +
|
|
|
+ " BOOKKEEP_PERIOD <= 201104" + Environment.NewLine +
|
|
|
+ "AND (" + Environment.NewLine +
|
|
|
+ " BOOKKEEP_PERIOD >= 201101 " + Environment.NewLine +
|
|
|
+ " OR (" + Environment.NewLine +
|
|
|
+ " T2.TYPE_ACCTT = '1' " + Environment.NewLine +
|
|
|
+ " AND BOOKKEEP_PERIOD >= 201001" + Environment.NewLine +
|
|
|
+ " )" + Environment.NewLine +
|
|
|
+ ")" + Environment.NewLine +
|
|
|
+ "ORDER BY 1,4,5;" + Environment.NewLine, config.SuSaKontenQuery);
|
|
|
+
|
|
|
+ config.AktuellePeriode = new Periode("201302");
|
|
|
+
|
|
|
+ Assert.AreEqual("" + Environment.NewLine +
|
|
|
+ "SELECT " + Environment.NewLine +
|
|
|
+ " T1.ACCT_NO," + Environment.NewLine +
|
|
|
+ " DEBIT_QUANTITY," + Environment.NewLine +
|
|
|
+ " CREDIT_QUANTITY," + Environment.NewLine +
|
|
|
+ " DEPARTMENT," + Environment.NewLine +
|
|
|
+ " BOOKKEEP_PERIOD," + Environment.NewLine +
|
|
|
+ " T2.TYPE_ACCTT" + Environment.NewLine +
|
|
|
+ "FROM deop00.dbo.ACCT_BALANCE T1" + Environment.NewLine +
|
|
|
+ "LEFT JOIN deop00.dbo.ACCOUNT_INFO T2 " + Environment.NewLine +
|
|
|
+ " ON T1.ACCT_NO=T2.ACCT_NR" + Environment.NewLine +
|
|
|
+ "WHERE " + Environment.NewLine +
|
|
|
+ " BOOKKEEP_PERIOD <= 201302" + Environment.NewLine +
|
|
|
+ "AND (" + Environment.NewLine +
|
|
|
+ " BOOKKEEP_PERIOD >= 201301 " + Environment.NewLine +
|
|
|
+ " OR (" + Environment.NewLine +
|
|
|
+ " T2.TYPE_ACCTT = '1' " + Environment.NewLine +
|
|
|
+ " AND BOOKKEEP_PERIOD >= 201301" + Environment.NewLine +
|
|
|
+ " )" + Environment.NewLine +
|
|
|
+ ")" + Environment.NewLine +
|
|
|
+ "ORDER BY 1,4,5;" + Environment.NewLine, config.StatKontenQuery);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ public void ManuelleKonten()
|
|
|
+ {
|
|
|
+ var dateipfade = new DateipfadeXml();
|
|
|
+ File.Delete(dateipfade.ManuelleKonten);
|
|
|
+
|
|
|
+ KonfigurationLaden("standard");
|
|
|
+
|
|
|
+ Assert.IsTrue(File.Exists(dateipfade.ManuelleKonten));
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ [Test]
|
|
|
+ public void Webservice()
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|