KonfigurationTest.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. using System;
  2. using System.IO;
  3. using GCHR.Model;
  4. using GCHR.Model.Mandant;
  5. using NUnit.Framework;
  6. namespace GCHR.Tests.Model
  7. {
  8. [TestFixture]
  9. public class KonfigurationTest
  10. {
  11. private static string PfadUndDatei(string dateiOhneEndung)
  12. {
  13. return Directory.GetCurrentDirectory() + "\\config\\" + dateiOhneEndung + ".xml";
  14. }
  15. private static Konfiguration KonfigurationLaden(string test)
  16. {
  17. return new Konfiguration(PfadUndDatei(test));
  18. }
  19. [Test]
  20. public void DateiMitStandardwertenAnlegen()
  21. {
  22. var datei = PfadUndDatei("standard");
  23. File.Delete(datei);
  24. var config = new Konfiguration(datei);
  25. Assert.IsTrue(File.Exists(datei));
  26. Assert.AreEqual("Autohaus", config.Haendler);
  27. Assert.AreEqual(Mandanten.Opel, config.Mandantenname);
  28. Assert.AreEqual(5, config.HerstellerKontenrahmenStellen);
  29. Assert.AreEqual(5, config.HaendlerKontenrahmenStellen);
  30. Assert.AreEqual("0", config.BilanzMarke);
  31. Assert.AreEqual("07", config.BilanzBetrieb);
  32. Assert.IsFalse(config.KontoOhneUebersetzungUebernehmen);
  33. Assert.IsTrue(config.StatKontenImportieren);
  34. Assert.AreEqual("01", config.Geschaeftsjahr);
  35. Assert.AreEqual("00000000", config.Eurodatanummer);
  36. Assert.AreEqual("000000", config.HaendlernummerBmCode);
  37. Assert.AreEqual("DSN=O21;UID=sa;PWD=;", config.OdbcConnectionString);
  38. Assert.AreEqual("deop00", config.Datenbank);
  39. config.AktuellePeriode = new Periode("201104", true);
  40. Assert.AreEqual("SELECT " + Environment.NewLine +
  41. " T1.ACCT_NO," + Environment.NewLine +
  42. " DEBIT_AMOUNT," + Environment.NewLine +
  43. " CREDIT_AMOUNT," + Environment.NewLine +
  44. " DEPARTMENT," + Environment.NewLine +
  45. " BOOKKEEP_PERIOD," + Environment.NewLine +
  46. " T2.TYPE_ACCTT" + Environment.NewLine +
  47. "FROM deop00.dbo.ACCT_BALANCE T1" + Environment.NewLine +
  48. "LEFT JOIN deop00.dbo.ACCOUNT_INFO T2 " + Environment.NewLine +
  49. " ON T1.ACCT_NO=T2.ACCT_NR" + Environment.NewLine +
  50. "WHERE " + Environment.NewLine +
  51. " BOOKKEEP_PERIOD <= 201104" + Environment.NewLine +
  52. "AND (" + Environment.NewLine +
  53. " BOOKKEEP_PERIOD >= 201101 " + Environment.NewLine +
  54. " OR (" + Environment.NewLine +
  55. " T2.TYPE_ACCTT = '1' " + Environment.NewLine +
  56. " AND BOOKKEEP_PERIOD >= 201001" + Environment.NewLine +
  57. " )" + Environment.NewLine +
  58. ")" + Environment.NewLine +
  59. "ORDER BY 1,4,5;" + Environment.NewLine, config.SuSaKontenQuery);
  60. config.AktuellePeriode = new Periode("201302");
  61. Assert.AreEqual("" + Environment.NewLine +
  62. "SELECT " + Environment.NewLine +
  63. " T1.ACCT_NO," + Environment.NewLine +
  64. " DEBIT_QUANTITY," + Environment.NewLine +
  65. " CREDIT_QUANTITY," + Environment.NewLine +
  66. " DEPARTMENT," + Environment.NewLine +
  67. " BOOKKEEP_PERIOD," + Environment.NewLine +
  68. " T2.TYPE_ACCTT" + Environment.NewLine +
  69. "FROM deop00.dbo.ACCT_BALANCE T1" + Environment.NewLine +
  70. "LEFT JOIN deop00.dbo.ACCOUNT_INFO T2 " + Environment.NewLine +
  71. " ON T1.ACCT_NO=T2.ACCT_NR" + Environment.NewLine +
  72. "WHERE " + Environment.NewLine +
  73. " BOOKKEEP_PERIOD <= 201302" + Environment.NewLine +
  74. "AND (" + Environment.NewLine +
  75. " BOOKKEEP_PERIOD >= 201301 " + Environment.NewLine +
  76. " OR (" + Environment.NewLine +
  77. " T2.TYPE_ACCTT = '1' " + Environment.NewLine +
  78. " AND BOOKKEEP_PERIOD >= 201301" + Environment.NewLine +
  79. " )" + Environment.NewLine +
  80. ")" + Environment.NewLine +
  81. "ORDER BY 1,4,5;" + Environment.NewLine, config.StatKontenQuery);
  82. }
  83. [Test]
  84. public void ManuelleKonten()
  85. {
  86. var dateipfade = new DateipfadeXml();
  87. File.Delete(dateipfade.ManuelleKonten);
  88. KonfigurationLaden("standard");
  89. Assert.IsTrue(File.Exists(dateipfade.ManuelleKonten));
  90. }
  91. [Test]
  92. public void Webservice()
  93. {
  94. }
  95. }
  96. }