<commit_before>﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Bolt.Client;
using Bolt.Client.Pipeline;
using Bolt.Pipeline;
using Bolt.Server.IntegrationTest.Core;
using Bolt.Test.Common;
using Microsoft.AspNet.Builder;
using Moq;
using Xunit;

namespace Bolt.Server.IntegrationTest
{
    public class StateLessTest : IntegrationTestBase
    {
        [Fact]
        public void NewProxy_EnsureReady()
        {
            var client = CreateChannel();
            Assert.Equal(ProxyState.Ready, ((IProxy)client).State);
        }

        [Fact]
        public async Task OpenAsync_EnsureOpened()
        {
            var client = CreateChannel();
            Mock<ITestContract> server = Server();

            await ((IProxy) client).OpenAsync();
            Assert.Equal(ProxyState.Open, ((IProxy)client).State);
        }

        [Fact]
        public async Task CloseAsync_EnsureClosed()
        {
            var client = CreateChannel();
            Mock<ITestContract> server = Server();

            await ((IProxy)client).OpenAsync();<commit_msg>- new tests added<commit_after>﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Bolt.Client;
using Bolt.Client.Pipeline;
using Bolt.Pipeline;
using Bolt.Server.IntegrationTest.Core;
using Bolt.Test.Common;
using Microsoft.AspNet.Builder;
using Moq;
using Xunit;

namespace Bolt.Server.IntegrationTest
{
    public class StateLessTest : IntegrationTestBase
    {
        [Fact]
        public void NewProxy_EnsureReady()
        {
            var client = CreateChannel();
            Assert.Equal(ProxyState.Ready, ((IProxy)client).State);
        }

        [Fact]
        public async Task OpenAsync_EnsureOpened()
        {
            var client = CreateChannel();
            Mock<ITestContract> server = Server();

            await ((IProxy) client).OpenAsync();
            Assert.Equal(ProxyState.Open, ((IProxy)client).State);
        }

        [Fact]
        public async Task ReusePipeline_Ok()
        {
            var pipeline = CreatePipeline();

            var client1 = CreateChannel(pipeline);
            var client2 = CreateChannel(pipeline);

            Mock<ITestContract> server = Server();
            server.Setup(s => s.SimpleMethod());

            await client1.SimpleMethodAsync();
            await client2.SimpleMethodAsync();
        }

        [Fact]
        public async Task DisposeProxy_EnsurePipelineWorking()
        {
            var pipeline = CreatePipeline();

            var client1 = CreateChannel(pipeline);
            var client2 = CreateChannel(pipeline);

            Mock<ITestContract> server = Server();
            server.Setup(s => s.SimpleMethod());

            await client1.SimpleMethodAsync();
            await client2.SimpleMethodAsync();

            (client1 as IDisposable)?.Dispose();
            await client2.SimpleMethodAsync();
        }

        [Fact]
        public async Task CloseAsync_EnsureClosed()
        {
            var client = CreateChannel();
            Mock<ITestContract> server = Server();

            await ((IProxy)client).OpenAsync();
{'fraction_non_alphanumeric': 0.10112019376324553, 'fraction_numerical': 0.003027550711474417, 'mean_word_length': 2.347517730496454, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2368398', 'n_tokens_mistral': 872, 'n_tokens_neox': 877, 'n_words': 197}