<commit_before>﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading.Tasks;
using System.Linq;
using System.Collections.Generic;
using System.Threading;
using System.Windows.Threading;

using Breeze.Sharp.Core;
using Breeze.Sharp;

using Northwind.Models;

namespace Test_NetClient
{
    [TestClass]
    public class QueryTests
    {
        private String _serviceName;

        [TestInitialize]
        public void TestInitializeMethod() {
            MetadataStore.Instance.ProbeAssemblies(typeof(Customer).Assembly);
            _serviceName = "http://localhost:56337/breeze/Northwind/";
        }

        [TestCleanup]
        public void TearDown() {
        }


        //*********************************************************
        // All customers - "Concise" style
        // Execute the query via a test helper method that encapsulates the ceremony
        //
        //*********************************************************

        [TestMethod]
        public async Task AllCustomers_Concise()
        {
            var query = EntityQuery.From<Customer>();                       // One way to create a basic EntityQuery
            await TestFns.VerifyQuery(query, _serviceName, "All customers");
        }

        //*********************************************************
        // All customers - Task style
        // Handle async task results explicitly
        //
        //*********************************************************
        
        [TestMethod]
        public async Task AllCustomers_Task()
        {
            var query = new EntityQuery<Customer>();                        // Alternate way to create a basic EntityQuery
            var entityManager = new EntityManager(_serviceName);
            await entityManager.ExecuteQuery(query).ContinueWith(task =>
                {
                    if (task.IsFaulted) {<commit_msg>Bill's Order/InternationalOrder breaking test<commit_after>﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading.Tasks;
using System.Linq;
using System.Collections.Generic;
using System.Threading;
using System.Windows.Threading;

using Breeze.Sharp.Core;
using Breeze.Sharp;

using Northwind.Models;

namespace Test_NetClient
{
    [TestClass]
    public class QueryTests
    {
        private String _serviceName;

        [TestInitialize]
        public void TestInitializeMethod() {
            MetadataStore.Instance.ProbeAssemblies(typeof(Customer).Assembly);
            _serviceName = "http://localhost:56337/breeze/Northwind/";
        }

        [TestCleanup]
        public void TearDown() {
        }

        [TestMethod]
        public async Task RequerySameEntity() {
          var entityManager = await TestFns.NewEm(_serviceName);

          // Orders with freight cost over 100.
          var query = new EntityQuery<Order>().Where(o => o.Freight > 100);
          var orders100 = await entityManager.ExecuteQuery(query);
          Assert.IsTrue(orders100.Any(), "There should be orders with freight cost > 100");

          var query2 = new EntityQuery<Order>().Where(o => o.Freight > 50);
          var orders50 = await entityManager.ExecuteQuery(query2);
          Assert.IsTrue(orders50.Any(), "There should be orders with freight cost > 50");

          Assert.IsTrue(orders50.Count() >= orders100.Count(), "There should be more orders with freight > 50 than 100");
        }


        //*********************************************************
        // All customers - "Concise" style
        // Execute the query via a test helper method that encapsulates the ceremony
        //
        //*********************************************************

        [TestMethod]
        public async Task AllCustomers_Concise()
        {
            var query = EntityQuery.From<Customer>();                       // One way to create a basic EntityQuery
            await TestFns.VerifyQuery(query, _serviceName, "All customers");
        }

        //*********************************************************
        // All customers - Task style
        // Handle async task results explicitly
        //
        //*********************************************************
        
        [TestMethod]
        public async Task AllCustomers_Task()
        {
            var query = new EntityQuery<Customer>();                        // Alternate way to create a basic EntityQuery
            var entityManager = new EntityManager(_serviceName);
            await entityManager.ExecuteQuery(query).ContinueWith(task =>
                {
                    if (task.IsFaulted) {
{'fraction_non_alphanumeric': 0.17791147400085947, 'fraction_numerical': 0.009669101847872797, 'mean_word_length': 2.3756345177664975, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5791664', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1083, 'n_words': 286}