public void ToBsonDocument_IdAssigned_MapsToBsonObjectId() { var user = new IdentityUser(); user.SetId(ObjectId.GenerateNewId().ToString()); var document = user.ToBsonDocument(); Expect(document["_id"], Is.TypeOf <BsonObjectId>()); }
public void Insert_NoId_SetsId() { var user = new IdentityUser(); user.SetId(null); Users.Insert(user); Expect(user.Id, Is.Not.Null); var parsed = user.Id.SafeParseObjectId(); Expect(parsed, Is.Not.Null); Expect(parsed, Is.Not.EqualTo(ObjectId.Empty)); }
public void Insert_NoId_SetsId() { var user = new IdentityUser(); user.SetId(null); DatabaseConnection.Run(IdentityContext.DB.Table <IdentityUser>("IdentityUsers").Insert(user)); //Users.Insert(user); Expect(user.Id, Is.Not.Null); var parsed = user.Id.SafeParseGuid(); Expect(parsed, Is.Not.Null); Expect(parsed, Is.Not.EqualTo(Guid.Empty)); }
public void FindById_SavedUser_ReturnsUser() { var userId = ObjectId.GenerateNewId().ToString(); var user = new IdentityUser { UserName = "******" }; user.SetId(userId); var manager = GetUserManager(); manager.Create(user); var foundUser = manager.FindById(userId); Expect(foundUser, Is.Not.Null); Expect(foundUser.Id, Is.EqualTo(userId)); }