12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using NUnit.Framework;
- using System.Diagnostics;
- using System.IO;
- using System.Xml.Serialization;
- using System.Threading;
- namespace HRep_WPF
- {
- [TestFixture]
- public class KonfigurationTest
- {
- private Konfiguration config;
- public KonfigurationTest()
- {
- String configFile = "test2.xml";
- GCExportConfig gceConfig = gceConfigTestwerteGenerieren();
- gceConfigTestwerteSpeichern(gceConfig, configFile);
- config = new Konfiguration(new ThreadXData(), configFile, "201001");
- }
- private void gceConfigTestwerteSpeichern(GCExportConfig gceConfig, String configFile)
- {
- XmlSerializer serializer = new XmlSerializer(typeof(GCExportConfig));
- using (TextWriter stream = new StreamWriter(configFile))
- {
- serializer.Serialize(stream, gceConfig);
- }
- }
- private GCExportConfig gceConfigTestwerteGenerieren()
- {
- GCExportConfig gceConfig = new GCExportConfig();
- gceConfig.Einstellungen.DepartmentUebersetzung.Add(new UebersetzungXml() { von = "1", nach = "2" });
- gceConfig.Einstellungen.DepartmentUebersetzung.Add(new UebersetzungXml() { von = "22", nach = "33" });
- gceConfig.Einstellungen.Eurodatanummer = "12345";
- KontoXml kto = new KontoXml() { Kontonummer = "81000" };
- kto.Periode.Add(new PeriodeXml() { Name = "201001", Debit = 0.01 });
- gceConfig.Konten.Add(kto);
- return gceConfig;
- }
- [Test]
- public void AktuellePeriode()
- {
- Assert.AreEqual("201001", config.aktuellePeriode.ToString());
- Assert.AreEqual("01", config.aktuellePeriode.Monat);
- Assert.AreEqual("2010", config.aktuellePeriode.Jahr);
- Assert.AreEqual("10", config.aktuellePeriode.JahrZweistellig);
- }
- [Test]
- public void Variablen()
- {
- Assert.AreEqual("00012345", config.Eurodatanummer);
- Assert.AreEqual("01", config.Geschaeftsjahr);
- }
- [Test]
- public void DepartmentUebersetzung()
- {
- Assert.AreEqual("312", config.DepartmentAnpassen("123"));
- Assert.AreEqual("211", config.DepartmentAnpassen("111"));
- Assert.AreEqual("033", config.DepartmentAnpassen("220"));
- Assert.AreEqual("233", config.DepartmentAnpassen("221"));
- }
- }
- }
|