コード例 #1
0
        public void ToBsonDocument_IdAssigned_MapsToBsonObjectId()
        {
            var user = new IdentityUser();

            var document = user.ToBsonDocument();

            Expect(document["_id"], Is.TypeOf <BsonObjectId>());
        }
コード例 #2
0
        public void UserWithoutClaims_MyClaims_AreIgnored()
        {
            var user = new IdentityUser();

            var document = user.ToBsonDocument();

            Assert.False(document.Contains("MyClaims"));
        }
コード例 #3
0
        public void User_Id_IsRepresentedAsBsonObjectId()
        {
            var user = new IdentityUser();

            var document = user.ToBsonDocument();

            Assert.IsType <BsonObjectId>(document["_id"]);
        }
コード例 #4
0
        public void Create_NoPassword_DoesNotSerializePasswordField()
        {
            // if a particular consuming application doesn't intend to use passwords, there's no reason to store a null entry except for padding concerns, if that is the case then the consumer may want to create a custom class map to serialize as desired.

            var user = new IdentityUser();

            var document = user.ToBsonDocument();

            Expect(document.Contains("PasswordHash"), Is.False);
        }
        public void Create_NullClaims_DoesNotSerializeClaims()
        {
            // serialized nulls can cause havoc in deserialization, overwriting the constructor's initial empty list
            var user = new IdentityUser();

            user.Claims = null;

            var document = user.ToBsonDocument();

            Expect(document.Contains("Claims"), Is.False);
        }