public void BySecondLetterTestMethod()
        {
            var ops     = new EntityFrameworkCoreOperations();
            var results = ops.GetCustomersWhereSecondLetterIs("_u%");

            Assert.IsTrue(results.Count == 9, "Expected nine for EF Core starts and ends with");
        }
        public void StartsEndsTestMethod()
        {
            var ops     = new EntityFrameworkCoreOperations();
            var results = ops.GetCustomersStartWithEndWithLinq("f%d");

            Assert.IsTrue(results.Count == 1, "Expected 1 for EF Core starts and ends with");
        }
Exemple #3
0
        private void CompanyNameFindButton_Click(object sender, EventArgs e)
        {
            _bindingSource.DataSource = null;

            var nameCondition        = CompanyNameConditionsComboBox.Text.ToEnum <LikeOptions>();
            var contactTypeCondition = ((ContactType)ContactTypeComboBox.SelectedItem).ContactTypeIdentifier;

            if (CompanyNameFindTextBox.Text.IsNullOrWhiteSpace() && contactTypeCondition == 0)
            {
                return;
            }

            var ops = new EntityFrameworkCoreOperations();

            var customerEntities = ops.GetCustomersLikeCustomerEntities(
                nameCondition,
                CompanyNameFindTextBox.Text,
                contactTypeCondition);

            _bindingSource.DataSource = customerEntities;
            dataGridView1.DataSource  = _bindingSource;
            dataGridView1.ExpandColumns();

            CurrentCustomerButton.Enabled = _bindingSource.Count > 0;
        }
        public void TestMethod1()
        {
            var ops     = new EntityFrameworkCoreOperations();
            var results = ops.GetCustomersStartsWithLambda("Fr%");

            Assert.IsTrue(results.Count == 2, "Expected two for EF Core test");

            results = ops.GetCustomersStartWithLinq("Fr%");
            Assert.IsTrue(results.Count == 2, "Expected two for EF Core test");
        }
        public void ByRangeOfNameTestMethod()
        {
            var ops     = new EntityFrameworkCoreOperations();
            var results = ops.GetCustomersWhereNameBeginsWithRange("[DA]%");

            foreach (var customerEntity in results)
            {
                Console.WriteLine(customerEntity.CompanyName);
            }
            Assert.IsTrue(results.Count == 7, "Expected 7 for EF Core starts and ends with");
        }
Exemple #6
0
        private void Form1_Shown(object sender, EventArgs e)
        {
            dataGridView1.AutoGenerateColumns = false;

            CompanyNameConditionsComboBox.Items.AddRange(Enum.GetNames(typeof(LikeOptions)));
            CompanyNameConditionsComboBox.SelectedIndex = 0;

            var ops = new EntityFrameworkCoreOperations();

            ContactTypeComboBox.DataSource = ops.ContactTypesList();
        }