예제 #1
0
        public async Task Insert_Button_And_Find_And_Delete_Test()
        {
            var client = new HistoryMapWebClient(user, pass);
            var record = new GenericLabelForWorldMap(new LocalDate(Era.BeforeCommon, 50, 5, 5), new Point(5, 5),
                                                     "SomeType", new Dictionary <string, string>()
            {
                { "Key", "Value" }
            }, 50, 50, Guid.NewGuid().ToString());

            //create record
            var a = await client.CreateRecord(record);

            Assert.IsTrue(a.Success);

            //Find record
            var allRecords = await client.GetButtons();

            var inserted = allRecords.SingleOrDefault(p => p._id == record._id);

            Assert.IsNotNull(inserted);

            //Delete record
            var deleteResult = await client.Delete <GenericLabelForWorldMap>(record._id);

            Assert.IsTrue(deleteResult.Success);

            //Check deletion
            allRecords = await client.GetButtons();

            inserted = allRecords.SingleOrDefault(p => p._id == record._id);

            Assert.IsNull(inserted);
        }
예제 #2
0
        public async Task Insert_Border_Test()
        {
            var client = new HistoryMapWebClient(user, pass);
            var a      = await client.CreateRecord(new BorderStorageClass(new LocalDate(Era.BeforeCommon, 50, 5, 5), Color.Black, new List <Point>()
            {
                new Point(50, 50)
            }));

            Assert.IsTrue(a.Success);
        }
예제 #3
0
        public async Task Insert_Button_Test()
        {
            var client = new HistoryMapWebClient(user, pass);
            var a      = client.CreateRecord(new GenericLabelForWorldMap(new LocalDate(Era.BeforeCommon, 50, 5, 5),
                                                                         new Point(5, 5), "SomeType", new Dictionary <string, string>()
            {
                { "Key", "Value" }
            }, 50, 50, Guid.NewGuid().ToString()));

            Assert.IsTrue(a.GetAwaiter().GetResult().Success);
        }
예제 #4
0
        /// <summary>
        /// This should save a new user based on the populated fields
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveNewUserBtn_Click(object sender, EventArgs e)
        {
            if (UserTxt.Text == "" || PassTxt.Text == "")
            {
                MessageBox.Show(@"Both the fields need to be filled in");
            }
            var tempUser = new UserClass(UserTxt.Text, PassTxt.Text);

            UserTxt.Text = "";
            PassTxt.Text = "";
            _client.CreateRecord(tempUser).GetAwaiter();
            SetupList();
        }
예제 #5
0
        public async Task InsertandUpdate_Button_AD()
        {
            var client = new HistoryMapWebClient(user, pass);
            var record = new GenericLabelForWorldMap(new LocalDate(Era.BeforeCommon, 50, 5, 5), new Point(5, 5),
                                                     "SomeType", new Dictionary <string, string>()
            {
                { "Key", "Value" }
            }, 50, 50, Guid.NewGuid().ToString());

            //create record
            var a = await client.CreateRecord(record);

            Assert.IsTrue(a.Success);

            //Find record
            var allRecords = await client.GetButtons();

            var inserted = allRecords.SingleOrDefault(p => p._id == record._id);

            Assert.IsNotNull(inserted);

            //Update record
            var newDate = new LocalDate(Era.Common, 1050, 05, 05);

            record.timeOf = newDate;
            var updateResult = await client.UpdateRecord(record);

            Assert.IsTrue(updateResult.Success);

            //Check update
            allRecords = await client.GetButtons();

            inserted = allRecords.SingleOrDefault(p => p._id == record._id);

            Assert.AreEqual(newDate, inserted.timeOf);
        }