public async Task OpenWindowsExplorer()
 {
     var sim = await EventBuilder.Create()
               .ClickChord(KeyCode.LWin, KeyCode.E)
               .Invoke()
     ;
 }
Example #2
0
        public void Should_have_error_when_FinishDate_is_null_or_invalid()
        {
            var   InvalidDate        = "2019/02/31";
            Event EventBuilderObject = EventBuilder
                                       .Create()
                                       .HasFinishDate(InvalidDate)
                                       .Builder();

            validator.ShouldHaveValidationErrorFor(e => e.FinishDate, EventBuilderObject);
        }
Example #3
0
        public void Should_have_error_when_Description_is_null_or_its_length_is_less_than_3()
        {
            var   InvalidDescription = string.Empty;
            Event EventBuilderObject = EventBuilder
                                       .Create()
                                       .HasDescription(InvalidDescription)
                                       .Builder();

            validator.ShouldHaveValidationErrorFor(e => e.Description, EventBuilderObject);
        }
Example #4
0
        public void Should_have_error_when_Name_is_null_or_its_length_is_less_than_3()
        {
            var   InvalidName        = string.Empty;
            Event EventBuilderObject = EventBuilder
                                       .Create()
                                       .HasName(InvalidName)
                                       .Builder();

            validator.ShouldHaveValidationErrorFor(e => e.Name, EventBuilderObject);
        }
Example #5
0
        public void Should_have_error_when_FinishDate_is_less_than_startDate()
        {
            var   finishDate         = "2019/02/19";
            var   startDate          = "2019/02/20";
            Event EventBuilderObject = EventBuilder
                                       .Create()
                                       .HasFinishDate(finishDate)
                                       .HasStartDate(startDate)
                                       .Builder();

            validator.ShouldHaveValidationErrorFor(e => e.FinishDate, EventBuilderObject);
        }
Example #6
0
        public void Should_have_create_an_event()
        {
            var EventTest = new
            {
                Name        = _Name,
                Description = _Description,
                StartDate   = new DateTime(2019, 03, 07),
                FinishDate  = new DateTime(2019, 03, 07),
                Id          = 0
            };

            Event EventBuilderObject = EventBuilder
                                       .Create()
                                       .HasName(EventTest.Name)
                                       .HasDescription(EventTest.Description)
                                       .HasStartDate(_StartDate)
                                       .HasFinishDate(_FinishDate)
                                       .Builder();

            EventTest.ToExpectedObject().ShouldMatch(EventBuilderObject);
        }
Example #7
0
 /// <summary>
 /// Create a new <see cref="EventBuilder"/> to construct a simulation chain.
 /// </summary>
 /// <returns></returns>
 public static EventBuilder Events()
 {
     return(EventBuilder.Create());
 }
Example #8
0
        public void TestUnicodeRanges(UnicodeRange range)
        {
            //Need to retest Thai, CJK Unified Ideo Extension A&B

            // ReSharper disable AccessToDisposedClosure

            var form = default(UnicodeTestForm);

            var FormTask = Task.Factory.StartNew(() => {
                using (form = new UnicodeTestForm(range.Name, range.Characters)) {
                    form.ShowDialog();
                }
            }, TaskCreationOptions.LongRunning);


            var Last = "";

            var simTask = Task.Factory.StartNew(
                async() => {
                while (form?.Ready != true)
                {
                    Thread.Sleep(250);
                }

                form.BringToForeground();

                var Delay = 10;

                var Chars = range.Characters;


                var Sim = EventBuilder.Create()
                          .Click(Chars)
                ;

                await Sim.Invoke();


                var MaxDelay      = 5000;
                var KeepComparing = true;
                while (form.Recieved != form.Expected && KeepComparing)
                {
                    Last = form.Recieved;
                    for (int i = 0; i < MaxDelay / Delay; i++)
                    {
                        if (Last == form.Recieved)
                        {
                            Thread.Sleep(Delay);
                        }
                        else
                        {
                            KeepComparing = false;
                            break;
                        }
                    }
                }

                form.Invoke(new Action(() => {
                    form.Close();
                }));
            }, TaskCreationOptions.LongRunning);

            Task.WaitAll(new[] { FormTask, simTask });

            Assert.That(form.Recieved, Is.EqualTo(form.Expected));

            // ReSharper restore AccessToDisposedClosure
        }