Пример #1
0
        public void CLIP_MESSAGE()
        {
            var monster = CreateLoggedInCookieMonster();
            var s       = "9 someplayer 1041253132 I'll log in at 10pm if you want to finish that game.";
            var cm      = monster.EatCookie(s);

            Assert.Equal(FibsCookie.CLIP_MESSAGE, cm.Cookie);
            Assert.Equal("someplayer", cm.Crumbs["from"]);
            Assert.Equal(DateTime.Parse("12/30/2002 12:58:52 PM"), CookieMonster.ParseTimestamp(cm.Crumbs["time"]));
            Assert.Equal("I'll log in at 10pm if you want to finish that game.", cm.Crumbs["message"]);
        }
Пример #2
0
        public void CLIP_WELCOME()
        {
            var monster = new CookieMonster();
            var s       = "1 myself 1041253132 192.168.1.308";
            var cm      = monster.EatCookie(s);

            Assert.Equal(FibsCookie.CLIP_WELCOME, cm.Cookie);
            Assert.Equal("myself", cm.Crumbs["name"]);
            var lastLogin = CookieMonster.ParseTimestamp(cm.Crumbs["lastLogin"]);

            Assert.Equal(DateTime.Parse("12/30/2002 12:58:52 PM"), lastLogin);
            Assert.Equal("192.168.1.308", cm.Crumbs["lastHost"]);
        }
Пример #3
0
        public void CLIP_WHO_INFO()
        {
            var monster = CreateLoggedInCookieMonster();
            var s       = "5 someplayer mgnu_advanced - 0 0 1418.61 23 1914 1041253132 192.168.40.3 MacFIBS [email protected]";
            var cm      = monster.EatCookie(s);

            Assert.Equal(FibsCookie.CLIP_WHO_INFO, cm.Cookie);
            Assert.Equal("someplayer", cm.Crumbs["name"]);
            Assert.Equal("mgnu_advanced", cm.Crumbs["opponent"]);
            Assert.Null(CookieMonster.ParseOptional(cm.Crumbs["watching"]));
            Assert.False(CookieMonster.ParseBool(cm.Crumbs["ready"]));
            Assert.False(CookieMonster.ParseBool(cm.Crumbs["away"]));
            Assert.InRange(double.Parse(cm.Crumbs["rating"]), 1418.60, 1418.62);
            Assert.Equal(23, int.Parse(cm.Crumbs["experience"]));
            Assert.Equal(1914, int.Parse(cm.Crumbs["idle"]));
            Assert.Equal(DateTime.Parse("12/30/2002 12:58:52 PM"), CookieMonster.ParseTimestamp(cm.Crumbs["login"]));
            Assert.Equal("192.168.40.3", cm.Crumbs["hostName"]);
            Assert.Equal("MacFIBS", CookieMonster.ParseOptional(cm.Crumbs["client"]));
            Assert.Equal("*****@*****.**", CookieMonster.ParseOptional(cm.Crumbs["email"]));
        }