<commit_before>﻿using System;
using NUnit.Framework;
using OpenQA.Selenium;

namespace Atata.KendoUI.Tests
{
    public class KendoDateInputTests : UITestFixture
    {
        private static DateInputPage GoToTestPage()
        {
            return Go.To<DateInputPage>();
        }

        [Test]
        public void KendoDateInput_Regular()
        {
            var control = GoToTestPage().Regular;

            control.Should.BeNull();

            TestControl(control);
        }

        private void TestControl<TPage>(KendoDateInput<TPage> control)
            where TPage : PageObject<TPage>
        {
            control.Should.BeEnabled();
            control.Should.Not.BeReadOnly();

            DateTime value1 = new DateTime(2018, 7, 11);
            control.Set(value1);
            control.Should.Equal(value1);

            control.Owner.Press(Keys.Tab);
            control.Should.Equal(value1);

            DateTime value2 = new DateTime(2019, 12, 31);
            control.Set(value2);
            control.Should.Equal(value2);

            DateTime value3 = new DateTime(1995, 5, 19);
            control.Set(value3);
            control.Should.Equal(value3);

            control.Set(null);
            control.Should.BeNull();
        }

        [Test]
        public void KendoDateInput_Disabled()
        {
            var control = GoToTestPage().Disabled;

            control.Should.BeDisabled();
            control.Should.Not.BeReadOnly();
            control.Should.Equal(new DateTime(2000, 10, 10));
        }

        [Test]
        public void KendoDateInput_ReadOnly()
        {
            var control = GoToTestPage().ReadOnly;

            control.Should.BeEnabled();
            control.Should.BeReadOnly();
            control.Should.Equal(new DateTime(2005, 7, 20));
        }

        [PlainTestCaseSource(KendoLibrary.React, KendoLibrary.Vue)]
        public void KendoDateInput(KendoLibrary library)
        {
            var control = GoToSnippetPage(library).Get<KendoDateInput<SnippetPage>>();
            TestControl(control);
        }

        [Test]
        [Explicit]
        public void NgKendoDateInput()
        {
            var control = GoToSnippetPage("https://www.telerik.com/kendo-angular-ui/components/dateinputs/dateinput/").<commit_msg>Refactor NgKendoDateInput test<commit_after>﻿using System;
using NUnit.Framework;
using OpenQA.Selenium;

namespace Atata.KendoUI.Tests
{
    public class KendoDateInputTests : UITestFixture
    {
        private static DateInputPage GoToTestPage()
        {
            return Go.To<DateInputPage>();
        }

        [Test]
        public void KendoDateInput_Regular()
        {
            var control = GoToTestPage().Regular;

            control.Should.BeNull();

            TestControl(control);
        }

        private void TestControl<TPage>(KendoDateInput<TPage> control)
            where TPage : PageObject<TPage>
        {
            control.Should.BeEnabled();
            control.Should.Not.BeReadOnly();

            DateTime value1 = new DateTime(2018, 7, 11);
            control.Set(value1);
            control.Should.Equal(value1);

            control.Owner.Press(Keys.Tab);
            control.Should.Equal(value1);

            DateTime value2 = new DateTime(2019, 12, 31);
            control.Set(value2);
            control.Should.Equal(value2);

            DateTime value3 = new DateTime(1995, 5, 19);
            control.Set(value3);
            control.Should.Equal(value3);

            control.Set(null);
            control.Should.BeNull();
        }

        [Test]
        public void KendoDateInput_Disabled()
        {
            var control = GoToTestPage().Disabled;

            control.Should.BeDisabled();
            control.Should.Not.BeReadOnly();
            control.Should.Equal(new DateTime(2000, 10, 10));
        }

        [Test]
        public void KendoDateInput_ReadOnly()
        {
            var control = GoToTestPage().ReadOnly;

            control.Should.BeEnabled();
            control.Should.BeReadOnly();
            control.Should.Equal(new DateTime(2005, 7, 20));
        }

        [PlainTestCaseSource(KendoLibrary.React, KendoLibrary.Vue)]
        public void KendoDateInput(KendoLibrary library)
        {
            var control = GoToSnippetPage(library).Get<KendoDateInput<SnippetPage>>();
            TestControl(control);
        }

        [Test]
        [Explicit]
        public void NgKendoDateInput()
        {
            var control = GoToSnippetPage(KendoLibrary.Angular, "dateinputs/dateinput").
{'fraction_non_alphanumeric': 0.10300522648083624, 'fraction_numerical': 0.020470383275261322, 'mean_word_length': 1.89413988657845, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3468', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1235, 'n_words': 218}