Ejemplo n.º 1
0
        public void TestFromObjectIds()
        {
            var objIds = new ObjectId[]
            {
                ObjectId.Empty,
                new ObjectId(0, 0, 0, 0),
                new ObjectId(0, 100, 200, 65535),
                new ObjectId(int.MaxValue, 0xffffff, short.MaxValue, 0xffffff),
            };

            var rqlIds = new RqlId[]
            {
                new RqlId("$0"),
                new RqlId("$0"),
                new RqlId("$1F2mgA9gNyZtkTId2"),
                new RqlId("$1F2si9jk4p8AzQuuP")
            };

            for (int i = 0; i < objIds.Length; i++)
            {
                var rqlId = objIds[i].ToRqlId();
                var objId = rqlId.ToObjectId();
                var rqlId2 = objId.ToRqlId();

                Assert.AreEqual(objIds[i], objId, "ObjectId value {0}", i);
                Assert.AreEqual(rqlIds[i], rqlId2, "RqlId value {0}", i);
            }
        }
Ejemplo n.º 2
0
        public void TestFromRqlIds()
        {
            var rqlIds = new RqlId[]
            {
                new RqlId("$0"),
                new RqlId("$0"),
                new RqlId("$1F2mgA9gNyZtkTIf6"),
                new RqlId("$1Ad4Xro7A6yeAl77J")  // This one caused problems

            };

            var objIds = new ObjectId[]
            {
                ObjectId.Empty,
                new ObjectId(0, 0, 0, 0),
                new ObjectId("8000000000006400c800ffff"),
                new ObjectId("53d5244dec98e866c0d800f4")
            };

            for (int i = 0; i < rqlIds.Length; i++)
            {
                var objId = rqlIds[i].ToObjectId();
                var rqlId = objId.ToRqlId();
                var objId2 = rqlId.ToObjectId();

                Assert.AreEqual(rqlIds[i], rqlId, "ObjectId value {0}", i);
                Assert.AreEqual(objIds[i], objId2, "RqlId value {0}", i);
            }
        }
Ejemplo n.º 3
0
        public SecurityToken(string userEmail, RqlId userId, TimeSpan? expiresIn = null)
        {
            UserEmail = userEmail;
            UserId = userId;

            if (expiresIn.HasValue)
                ExpiresAtUtc = DateTime.UtcNow.Add(expiresIn.Value);
            else
                ExpiresAtUtc = null;
        }
Ejemplo n.º 4
0
 public static bool TryParse(string s, out RqlId id)
 {
     try
     {
         id = RqlId.Parse(s);
         return(true);
     }
     catch (Exception)
     {
         id = Zero;
         return(false);
     }
 }
Ejemplo n.º 5
0
        public void TestFromString()
        {
            var datas = new string[]
            {
                "$0",
                "$1",
                "$123abcABC",
                "$ZZZZZZZZZ"
            };

            for (int i = 0; i < datas.Length; i++)
            {
                var id1 = new RqlId(datas[i]);
                var s = id1.ToString();
                var id2 = new RqlId(s);

                Assert.AreEqual(id1, id2, "Data value {0}", i);
            }
        }
Ejemplo n.º 6
0
 public PostResponse(RqlDateTime created, RqlId id)
 {
     Created = created;
     Id = id;
 }
Ejemplo n.º 7
0
 public static bool TryParse(string s, out RqlId id)
 {
     try
     {
         id = RqlId.Parse(s);
         return true;
     }
     catch (Exception)
     {
         id = Zero;
         return false;
     }
 }
Ejemplo n.º 8
0
 public RqlId(RqlId other)
 {
     this.id = other.id;
 }
Ejemplo n.º 9
0
 public bool Equals(RqlId other)
 {
     return other.id == this.id;
 }
Ejemplo n.º 10
0
 public RqlId(RqlId other)
 {
     this.id = other.id;
 }
Ejemplo n.º 11
0
 public bool Equals(RqlId other)
 {
     return(other.id == this.id);
 }
Ejemplo n.º 12
0
        public override bool Equals(object obj)
        {
            RqlId other = (RqlId)obj;

            return(other.id == this.id);
        }