public async Task Should_Create_User() { string userName = "******"; using (IDocumentStore store = CreateEmbeddableStore()) using (IAsyncDocumentSession ses = store.OpenAsyncSession()) { IUserStore<RavenUser> userStore = new RavenUserStore<RavenUser>(ses); await userStore.CreateAsync(new RavenUser { UserName = userName }); IUser user = (await ses.Query<RavenUser>() .Where(usr => usr.UserName == userName) .Take(1) .ToListAsync() .ConfigureAwait(false)).FirstOrDefault(); Assert.NotNull(user); } }
public async Task Should_Create_User() { string userName = "******"; using (IDocumentStore store = CreateEmbeddableStore()) using (IAsyncDocumentSession ses = store.OpenAsyncSession()) { ses.Advanced.UseOptimisticConcurrency = true; IUserStore <RavenUser> userStore = new RavenUserStore <RavenUser>(ses); await userStore.CreateAsync(new RavenUser(userName)); IUser user = (await ses.Query <RavenUser>() .Where(usr => usr.UserName == userName) .Take(1) .ToListAsync() .ConfigureAwait(false)).FirstOrDefault(); Assert.NotNull(user); } }
public async Task CreateAsync_Should_Create_User_By_Putting_The_UserName_As_The_Key() { string userName = "******"; using (IDocumentStore store = CreateEmbeddableStore()) using (IAsyncDocumentSession ses = store.OpenAsyncSession()) { ses.Advanced.UseOptimisticConcurrency = true; IUserStore<RavenUser> userStore = new RavenUserStore<RavenUser>(ses); await userStore.CreateAsync(new RavenUser(userName)); IUser user = (await ses.Query<RavenUser>() .Where(usr => usr.UserName == userName) .Take(1) .ToListAsync() .ConfigureAwait(false)).FirstOrDefault(); Assert.NotNull(user); Assert.Equal(string.Format(Constants.RavenUserKeyTemplate, userName), user.Id); } }