Beispiel #1
0
        public void EventsTab_CanExtend_Invoke_ReturnsTrue(object extendee)
        {
            var mockServiceProvider = new Mock <IServiceProvider>(MockBehavior.Strict);
            var tab = new EventsTab(mockServiceProvider.Object);

            Assert.True(tab.CanExtend(extendee));
        }
Beispiel #2
0
        public void EventsTab_GetDefaultProperty_Invoke_ReturnsExpected(object obj, IServiceProvider serviceProvider, object expected)
        {
            var tab = new EventsTab(serviceProvider);

            Assert.Same(expected, tab.GetDefaultProperty(obj));

            // Call again to test caching behavior.
            Assert.Same(expected, tab.GetDefaultProperty(obj));
        }
Beispiel #3
0
        public void EventsTab_Ctor_IServiceProvider()
        {
            var mockServiceProvider = new Mock <IServiceProvider>(MockBehavior.Strict);
            var tab = new EventsTab(mockServiceProvider.Object);

            Assert.NotNull(tab.Bitmap);
            Assert.Null(tab.Components);
            Assert.Equal("Events", tab.HelpKeyword);
            Assert.Equal("Events", tab.TabName);
        }
Beispiel #4
0
 private void btnEventDelete_Click(object sender, EventArgs e)
 {
     if (EventsTab.DeleteEvent(
             tbNewEventsNumber.Text.Trim(),
             numericUpDownEventAgeLimit.Text.Trim(),
             tbNewEventsName.Text.Trim(),
             comboBoxEventsSex.Text.Trim()))
     {
         LoadEventList();
     }
 }
Beispiel #5
0
 private void btnEventEdit_Click(object sender, EventArgs e)
 {
     if (EventsTab.AddEvent(
             tbNewEventsNumber.Text.Trim(),
             numericUpDownEventAgeLimit.Text.Trim(),
             tbNewEventsName.Text.Trim(),
             comboBoxEventsSex.Text.Trim(),
             editMode: true))
     {
         LoadEventList();
     }
 }
Beispiel #6
0
 private void btnAddEvent_Click(object sender, EventArgs e)
 {
     if (EventsTab.AddEvent(tbNewEventsNumber.Text.Trim(),
                            numericUpDownEventAgeLimit.Text.Trim(),
                            tbNewEventsName.Text.Trim(),
                            comboBoxEventsSex.Text.Trim()))
     {
         statusViewer.Update("Event added !", Status.SUCCESS);
         LoadEventList();
         ClearEventsTab();
     }
 }
Beispiel #7
0
        public void EventsTab_GetDefaultProperty_IDesignerEventService_Success(object obj, ActiveDesignerEventArgs e, object expected)
        {
            using var service = new CustomDesignerEventService();
            var mockServiceProvider = new Mock <IServiceProvider>(MockBehavior.Strict);

            mockServiceProvider
            .Setup(p => p.GetService(typeof(IDesignerEventService)))
            .Returns(service);
            var tab = new EventsTab(mockServiceProvider.Object);

            Assert.Null(tab.GetDefaultProperty(obj));

            service.OnActiveDesignerChanged(e);
            Assert.Equal(expected, tab.GetDefaultProperty(obj));
        }
Beispiel #8
0
        private void EventSearchClick(object sender, EventArgs e)
        {
            Event searchedEvent = EventsTab.SearchEvent(
                tbNewEventsNumber.Text,
                numericUpDownEventAgeLimit.Text,
                tbNewEventsName.Text,
                comboBoxEventsSex.Text);

            if (searchedEvent != null)
            {
                tbNewEventsNumber.Text          = searchedEvent.Number;
                tbNewEventsName.Text            = searchedEvent.Name;
                comboBoxEventsSex.Text          = searchedEvent.Gender;
                numericUpDownEventAgeLimit.Text = searchedEvent.AgeLimit.ToString();
            }
        }