Пример #1
0
        public void TestLogCreationUpdatingAndDeletion()
        {
            var log = new LogEntity {
                PersonDbId   = 1,
                Action       = "register",
                Client       = "someclient 8",
                PollingTable = "8",
                Timestamp    = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds
            };

            log.Save();

            log = new LogEntity();
            log.Load(new Hashtable {
                { "client", "someclient 8" }
            });

            Assert.That(log.Exists());
            Assert.That(log.PersonDbId == 1);
            Assert.That(log.Action == "register");
            Assert.That(log.Client == "someclient 8");
            Assert.That(log.PollingTable == "8");
            Assert.That(log.Timestamp > 0);

            log.Action       = "unregister";
            log.PollingTable = "5";

            log.Save();

            log = new LogEntity();
            log.Load(new Hashtable {
                { "client", "someclient 8" }
            });

            Assert.That(log.Exists());
            Assert.That(log.PersonDbId == 1);
            Assert.That(log.Action == "unregister");
            Assert.That(log.Client == "someclient 8");
            Assert.That(log.PollingTable == "5");
            Assert.That(log.Timestamp > 0);

            log.Delete();

            log = new LogEntity();
            log.Load(new Hashtable {
                { "client", "someclient 8" }
            });

            Assert.That(!log.Exists());
        }