コード例 #1
0
		public void ToBsonDocument_IdAssigned_MapsToBsonObjectId()
		{
			var user = new IdentityUser();
			user.SetId(ObjectId.GenerateNewId().ToString());

			var document = user.ToBsonDocument();

			Expect(document["_id"], Is.TypeOf<BsonObjectId>());
		}
コード例 #2
0
		public void Create_NullLogins_DoesNotSerializeLogins()
		{
			// serialized nulls can cause havoc in deserialization, overwriting the constructor's initial empty list 
			var user = new IdentityUser();
			user.Logins = null;

			var document = user.ToBsonDocument();

			Expect(document.Contains("Logins"), Is.False);
		}
コード例 #3
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);
		}