Example #1
0
        public void TestActionToString()
        {
            string s = FileStorageHelper.ActionToString("1", "1", DateTimeOffset.Parse("2015-04-16T14:00:00.000+0000"), BeaconEventType.Enter, "1");

            Assert.AreEqual("1,1,1429192800000,1,False,False,1\n", s);
            s = FileStorageHelper.ActionToString("1", "1", DateTimeOffset.Parse("2015-04-16T14:00:00.000+0000"), BeaconEventType.Enter, "1234235235");
            Assert.AreEqual("1,1,1429192800000,1,False,False,1234235235\n", s);
            s = FileStorageHelper.ActionToString("1", "1", DateTimeOffset.Parse("2015-04-16T14:00:00.000+0000"), BeaconEventType.Enter, "");
            Assert.AreEqual("1,1,1429192800000,1,False,False,\n", s);
            s = FileStorageHelper.ActionToString("1", "1", DateTimeOffset.Parse("2015-04-16T14:00:00.000+0000"), BeaconEventType.Enter, null);
            Assert.AreEqual("1,1,1429192800000,1,False,False,\n", s);


            s = FileStorageHelper.ActionToString(new HistoryAction()
            {
                EventId = "1", BeaconId = "1", ActionTime = DateTimeOffset.Parse("2015-04-16T14:00:00.000+0000").ToString(History.Timeformat), Trigger = (int)BeaconEventType.Enter, Delivered = false
            });
            Assert.AreEqual("1,1,1429192800000,1,False,False,\n", s);
            s = FileStorageHelper.ActionToString(new HistoryAction()
            {
                EventId = "1", BeaconId = "1", ActionTime = DateTimeOffset.Parse("2015-04-16T14:00:00.000+0000").ToString(History.Timeformat), Trigger = (int)BeaconEventType.Enter, Delivered = false, Location = ""
            });
            Assert.AreEqual("1,1,1429192800000,1,False,False,\n", s);
            s = FileStorageHelper.ActionToString(new HistoryAction()
            {
                EventId = "1", BeaconId = "1", ActionTime = DateTimeOffset.Parse("2015-04-16T14:00:00.000+0000").ToString(History.Timeformat), Trigger = (int)BeaconEventType.Enter, Delivered = false, Location = "1234567"
            });
            Assert.AreEqual("1,1,1429192800000,1,False,False,1234567\n", s);
        }