예제 #1
0
        public async Task ユーザーが存在する場合にセキュリティスタンプの更新コマンドが実行されるとDOMSコンテキストのユーザーが作成される()
        {
            await context.Users.AddAsync(new DocmsUser()
            {
                Id            = "known_user",
                SecurityStamp = "SECURITY_STAMP1"
            });

            await context.SaveChangesAsync();

            await sut.Handle(new UpdateSecurityStampCommand()
            {
                UserId        = "known_user",
                SecurityStamp = "SECURITY_STAMP2"
            });

            var user = await context.Users.FindAsync("known_user");

            Assert.AreEqual("SECURITY_STAMP2", user.SecurityStamp);
        }
예제 #2
0
        public async Task クライアントの一覧を取得できる()
        {
            var context = new MockDocmsContext("ClientsQueriesTests");
            var sut     = new ClientsQueries(context);

            context.ClientInfo.Add(new ClientInfo()
            {
                ClientId  = "client1",
                Type      = "UPLOADER",
                IpAddress = "192.168.10.1",
            });
            context.ClientInfo.Add(new ClientInfo()
            {
                ClientId  = "client2",
                Type      = "UPLOADER",
                IpAddress = "192.168.10.2",
            });
            await context.SaveChangesAsync();

            var clients = await sut.GetClients().ToListAsync();

            Assert.AreEqual(2, clients.Count());
        }
 public async Task Teardown()
 {
     ctx.ClientInfo.RemoveRange(ctx.ClientInfo);
     await ctx.SaveChangesAsync();
 }
 public async Task Teardown()
 {
     ctx.DeviceGrants.RemoveRange(ctx.DeviceGrants);
     await ctx.SaveChangesAsync();
 }