Microsoft.AspNet.Identity.IUserStore.CreateAsync(RavenUser)

Here are the examples of the csharp api class Microsoft.AspNet.Identity.IUserStore.CreateAsync(RavenUser) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

1. Example

Project: AspNet.Identity.RavenDB
Source File: RavenUserStoreFacts.cs
[Fact]
        public async Task Should_Create_User()
        {
            string userName = "Tugberk";

            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);
            }
        }

2. Example

Project: AspNet.Identity.RavenDB
Source File: RavenUserStoreFacts.cs
[Fact]
        public async Task CreateAsync_Should_Create_User_By_Putting_The_UserName_As_The_Key()
        {
            string userName = "Tugberk";

            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);
            }
        }