Beispiel #1
0
        public async Task UpdateActivityTest()
        {
            DatabaseSystem databaseSystem         = new DatabaseSystem();
            Dictionary <string, string> testValue = new Dictionary <string, string>();

            testValue.Add("ActivityId", "99");
            testValue.Add("ActivityName", "unitTest2");
            testValue.Add("HomeOwnerId", "unitTest1");
            testValue.Add("ActivityDate", "1998/02/11");
            testValue.Add("ActivityNote", "unitTest");
            testValue.Add("NumberOfPeople", "3");

            var result = await databaseSystem.UpdateActivity("99", testValue);

            await databaseSystem.Delete("99", "Activity");

            Assert.IsTrue(result);
        }
Beispiel #2
0
        public async Task UpdateMemberInfoTest()
        {
            DatabaseSystem databaseSystem = new DatabaseSystem();
            Member         member         = new Member();

            member.MemberId   = "unitTest4";
            member.MemberName = "zxczxc";
            member.Password   = "******";
            member.Phone      = "0326598741";
            member.Birthday   = "10/10/1659";
            member.Sexuality  = "女";

            var result = await databaseSystem.UpdateMemberInfo(member);

            await databaseSystem.Delete("unitTest4", "Member");

            Assert.IsTrue(result);
        }
Beispiel #3
0
        public async Task InsertActivityTest()
        {
            DatabaseSystem databaseSystem = new DatabaseSystem();
            Activity       activity       = new Activity();

            activity.ActivityId     = "99";
            activity.ActivityName   = "unitTest2";
            activity.HomeOwnerId    = "unitTest1";
            activity.ActivityDate   = "2020/02/02";
            activity.ActivityNote   = "unitTest";
            activity.NumberOfPeople = "3";

            var result = await databaseSystem.InsertActivity(activity);

            await databaseSystem.Delete("99", "Activity");

            Assert.IsTrue(result);
        }
Beispiel #4
0
        public async Task SendMessageTest()
        {
            DatabaseSystem databaseSystem = new DatabaseSystem();
            Message        message        = new Message("unitTest1", "unitTest1", "unitTestMessage");
            Activity       activity       = new Activity();

            activity.ActivityId     = "99";
            activity.ActivityName   = "unitTest2";
            activity.HomeOwnerId    = "unitTest1";
            activity.ActivityDate   = "2020/02/02";
            activity.ActivityNote   = "unitTest";
            activity.NumberOfPeople = "3";

            await databaseSystem.InsertActivity(activity);

            Assert.IsTrue(await databaseSystem.SendMessage("99", message));
            await databaseSystem.Delete("99", "Activity");
        }
Beispiel #5
0
        public async Task InitializationActivityDataTest()
        {
            DatabaseSystem databaseSystem = new DatabaseSystem();
            Activity       activity       = new Activity();

            activity.ActivityId     = "99";
            activity.ActivityName   = "unitTest2";
            activity.HomeOwnerId    = "unitTest1";
            activity.ActivityDate   = "2020/02/02";
            activity.ActivityNote   = "unitTest";
            activity.NumberOfPeople = "3";
            await databaseSystem.InsertActivity(activity);

            List <Activity> activityList = await databaseSystem.InitializationActivityData();

            await databaseSystem.Delete("99", "Activity");

            Assert.IsNotNull(activityList.Find(x => x.ActivityId == "99"));
        }
Beispiel #6
0
        public async Task InitializationMemberDataTest()
        {
            DatabaseSystem databaseSystem = new DatabaseSystem();
            Member         member         = new Member();

            member.MemberId   = "unitTest4";
            member.MemberName = "zxczxc";
            member.Password   = "******";
            member.Phone      = "0326598741";
            member.Birthday   = "10/10/1659";
            member.Sexuality  = "女";

            await databaseSystem.UpdateMemberInfo(member);

            List <Member> memberList = await databaseSystem.InitializationMemberData();

            await databaseSystem.Delete("unitTest4", "Member");

            Assert.IsNotNull(memberList.Find(x => x.MemberId == "unitTest4"));
        }
Beispiel #7
0
        public async Task <ActionResult> CloseActivity(string activityId, string memberId)
        {
            await InitializationModel();

            int result = _activityHandler.CloseActivity(activityId, memberId);

            if (result == 0)
            {
                await _databaseSystem.Delete(activityId, "Activity");

                return(Json(new { success = true, responseText = "關閉成功" }, JsonRequestBehavior.AllowGet));
            }
            else if (result == 1)
            {
                return(Json(new { success = true, responseText = "關閉失敗,活動不存在" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { success = true, responseText = "關閉失敗,您沒有權限" }, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #8
0
        public async Task GetChatDataTest()
        {
            DatabaseSystem databaseSystem = new DatabaseSystem();
            List <Message> messages       = new List <Message>();

            Message  message  = new Message("unitTest1", "unitTest1", "unitTestMessage");
            Activity activity = new Activity();

            activity.ActivityId     = "99";
            activity.ActivityName   = "unitTest2";
            activity.HomeOwnerId    = "unitTest1";
            activity.ActivityDate   = "2020/02/02";
            activity.ActivityNote   = "unitTest";
            activity.NumberOfPeople = "3";
            await databaseSystem.InsertActivity(activity);

            await databaseSystem.SendMessage("99", message);

            messages = await databaseSystem.GetChatData("99");

            await databaseSystem.Delete("99", "Activity");

            Assert.AreEqual("unitTest1", messages[0].MemberId);
        }
Beispiel #9
0
        public async Task UpdateInvitedListTest()
        {
            DatabaseSystem databaseSystem = new DatabaseSystem();
            Member         member         = new Member();

            member.MemberId   = "unitTest4";
            member.MemberName = "zxczxc";
            member.Password   = "******";
            member.Phone      = "0326598741";
            member.Birthday   = "10/10/1659";
            member.Sexuality  = "女";

            Dictionary <string, string> newInvitedList = new Dictionary <string, string>();

            newInvitedList.Add("1", "asd123");

            await databaseSystem.UpdateMemberInfo(member);

            var result = await databaseSystem.UpdateInvitedList("unitTest4", newInvitedList);

            await databaseSystem.Delete("unitTest4", "Member");

            Assert.IsTrue(result);
        }