예제 #1
0
        public bool viewEventListingByEventNameTest()
        {
            bool testResult = false;

            ActiveUser target = new ActiveUser();

            foreach(string testData in _testData)
            {
                string word = testData; // Test Case HERE
                List<EventEntity> actual = new List<EventEntity>();
                actual = target.viewEventListingByEventName(word);

                //Assert
                // List of names of actual events
                foreach(EventEntity events in actual)
                {
                    if (this._expectedListOfNames.Contains(events.getEventName()))
                    {
                        testResult = true;
                    }
                    else
                    {
                        testResult = false;
                    }
                }
            }

            return testResult;
        }
예제 #2
0
        private void searchEvent()
        {
            searchEventTextBox.Text = searchEventTextBox.Text.Trim();

            ActiveUser userRole = new ActiveUser(currentUser);

            this.listMainEventView.Items.Clear();
            int i;

            if (searchEventTextBox.Text == "" || searchEventTextBox.Text == "Search Your Event Here")
            {
                List<EventEntity> outputEventListing = userRole.viewEventListing();

                for (i = 0; i < outputEventListing.Count; i++)
                {
                    EventEntity outputEvent = outputEventListing[i];

                    ListViewItem newEvent = new ListViewItem((i + 1).ToString());
                    newEvent.SubItems.Add(outputEvent.getEventId().ToString());
                    newEvent.SubItems.Add(outputEvent.getEventName());
                    newEvent.SubItems.Add(outputEvent.getEventDate().ToString("dd/MM/yy"));
                    newEvent.SubItems.Add(outputEvent.getEventDate().ToString("t"));

                    listMainEventView.Items.Add(newEvent);
                }

                displayMainEventList();
            }

            else
            {
                List<EventEntity> outputEventListing = userRole.viewEventListingByEventName(searchEventTextBox.Text);

                for (i = 0; i < outputEventListing.Count; i++)
                {
                    EventEntity outputEvent = outputEventListing[i];

                    ListViewItem newEvent = new ListViewItem((i + 1).ToString());
                    newEvent.SubItems.Add(outputEvent.getEventId().ToString());
                    newEvent.SubItems.Add(outputEvent.getEventName());
                    newEvent.SubItems.Add(outputEvent.getEventDate().ToString("dd/MM/yy"));
                    newEvent.SubItems.Add(outputEvent.getEventDate().ToString("t"));

                    listMainEventView.Items.Add(newEvent);
                }

                displayMainEventList();
            }
        }