예제 #1
0
        public override void SetUp()
        {
            base.SetUp();

            UserDbCommand.SaveAsync(_author).Wait();
            UserDbCommand.SaveAsync(_collaborator1).Wait();
            UserDbCommand.SaveAsync(_collaborator2).Wait();
            UserDbCommand.SaveAsync(_collaborator3).Wait();
        }
예제 #2
0
        public async Task 正常系_作成とIDでの取得()
        {
            var user = new User(@"TestDomain\TestUser001")
            {
                Name        = "create_test_001",
                DisplayName = "作成テスト1"
            };

            await UserDbCommand.SaveAsync(user);

            var created = await UserDbCommand.FindAsync(user.Id);

            created.IsStructuralEqual(user);
        }
예제 #3
0
        public async Task 正常系_作成とログオン名での取得()
        {
            var user = new User(@"TestDomain\TestUser002")
            {
                Name        = "create_test_002",
                DisplayName = "作成テスト2"
            };

            await UserDbCommand.SaveAsync(user);

            var created = await UserDbCommand.FindByLogonNameAsync(user.LogonName);

            created.IsStructuralEqual(user);
        }
        public virtual void SetUp()
        {
            if (!_isDbInitialized)
            {
                // テスト初回のみ、すでにDBが存在したらDBを再作成する
                DropAllTable();
                _isDbInitialized = true;
            }

            Database.Initialize(ConnectionString);
            DapperConfig.Initialize();

            UserDbCommand.SaveAsync(LogonUser).Wait();
        }
예제 #5
0
        public async Task 正常系_記事_作者での抽出()
        {
            var author = new User(@"TestDomain\GetByAuthorTest")
            {
                Name = "GetByAuthorTest", DisplayName = "GetByAuthorTest"
            };
            await UserDbCommand.SaveAsync(author);

            await DraftDbCommand.DeleteByUserAsync(author);

            var draft1 = Draft.NewDraft(author, ItemType.Article);

            draft1.Title = "title1";
            draft1.LastModifiedDateTime = new DateTime(2015, 1, 1);

            var draft2 = Draft.NewDraft(author, ItemType.Article);

            draft2.Title = "title2";
            draft2.LastModifiedDateTime = new DateTime(2015, 2, 1);

            var draft3 = Draft.NewDraft(author, ItemType.Article);

            draft3.Title = "title3";
            draft3.LastModifiedDateTime = new DateTime(2015, 3, 1);

            var draft4 = Draft.NewDraft(author, ItemType.Article);

            draft4.Title = "title4";
            draft4.LastModifiedDateTime = new DateTime(2015, 4, 1);

            await DraftDbCommand.SaveAsync(draft1);

            await DraftDbCommand.SaveAsync(draft2);

            await DraftDbCommand.SaveAsync(draft3);

            await DraftDbCommand.SaveAsync(draft4);

            var registered = await DraftDbCommand.GetByUserAsync(author);

            registered.IsStructuralEqual(new[] { draft4, draft3, draft2, draft1 });
        }
예제 #6
0
        public async Task 正常系_ユーザー情報の更新()
        {
            var create = new User(@"TestDomain\TestUser004")
            {
                Name        = "create",
                DisplayName = "作成",
            };

            await UserDbCommand.SaveAsync(create);

            var created = await UserDbCommand.FindAsync(create.Id);

            created.Name        = "update";
            created.DisplayName = "更新";

            await UserDbCommand.SaveAsync(created);

            var updated = await UserDbCommand.FindAsync(create.Id);


            updated.IsStructuralEqual(created);
        }