Beispiel #1
0
        public void AddPayments(IEnumerable <Payment> payments)
        {
            int totalCount = 0;
            int newCount   = 0;

            foreach (Payment p in payments)
            {
                ++totalCount;
                p.OwnName = OwnName(p);
                if (!Payments.Contains(p))
                {
                    Payments.Add(p);

                    ++newCount;
                    StringWriter w = new StringWriter();
                    w.WriteLine("new:");
                    p.Print(w);
                    log.Debug(w.ToString());
                }
                else
                {
                    StringWriter w = new StringWriter();
                    w.WriteLine("known:");
                    p.Print(w);
                    log.Debug(w.ToString());
                }
            }
            log.InfoFormat("Total: {0}, New: {1}", totalCount, newCount);
        }
Beispiel #2
0
        public void TestCollectorSample()
        {
            ICollector c = new Sidi.Sammy.CollectorSample.CollectorSample();
            string path = FileUtil.BinFile(@"test-data\test.sqlite");
            if (File.Exists(path)) File.Delete(path);
            Sidi.Persistence.Collection<Payment> pc = new Sidi.Persistence.Collection<Payment>(path);
            IList<Payment> p = c.GetPayments();
            foreach (Payment i in p)
            {
                pc.Add(i);
            }

            foreach (Payment i in p)
            {
                Assert.AreEqual(true, pc.Contains(i));
            }
        }
Beispiel #3
0
        public void TestCollectorSample()
        {
            ICollector c    = new Sidi.Sammy.CollectorSample.CollectorSample();
            string     path = FileUtil.BinFile(@"test-data\test.sqlite");

            if (File.Exists(path))
            {
                File.Delete(path);
            }
            Sidi.Persistence.Collection <Payment> pc = new Sidi.Persistence.Collection <Payment>(path);
            IList <Payment> p = c.GetPayments();

            foreach (Payment i in p)
            {
                pc.Add(i);
            }

            foreach (Payment i in p)
            {
                Assert.AreEqual(true, pc.Contains(i));
            }
        }