Example #1
0
        /*Willie End*/

        /* Ting Start */
        public async Task <JsonResult> CreateActivity(Activity activityInfo, string memberId)
        {
            await InitializationModel();

            activityInfo.ParticipantList.Add(memberId);
            _activityHandler.CreateActivity(activityInfo);
            await _databaseSystem.InsertActivity(activityInfo);

            return(Json(true));
        }
Example #2
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);
        }
Example #3
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");
        }
Example #4
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"));
        }
Example #5
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);
        }