Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions src/Microsoft.Data.SqlClient/tests/Common/DisposableArray.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections;
using System.Collections.Generic;

namespace Microsoft.Data.SqlClient.Tests.Common
{
public class DisposableArray<T> : IDisposable, IEnumerable<T>
where T : IDisposable
{
private readonly T[] _elements;

public T this[int i]
{
get => _elements[i];
set => _elements[i] = value;
}

public int Length => _elements.Length;

public DisposableArray(int size)
{
_elements = new T[size];
}

public DisposableArray(T[] elements)
{
_elements = elements;
}

public void Dispose()
{
foreach (T element in _elements)
{
element?.Dispose();
}

GC.SuppressFinalize(this);
}

public IEnumerator<T> GetEnumerator() =>
((IEnumerable<T>)_elements).GetEnumerator();

IEnumerator IEnumerable.GetEnumerator() =>
_elements.GetEnumerator();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@ public static bool AreConnStringsSetup()
return !string.IsNullOrEmpty(NPConnectionString) && !string.IsNullOrEmpty(TCPConnectionString);
}

public static bool AreConnStringsNotAzureSynapse() =>
AreConnStringsSetup() && IsNotAzureSynapse();

public static bool IsSQL2022() => string.Equals("16", SQLServerVersion.Trim());

public static bool IsSQL2019() => string.Equals("15", SQLServerVersion.Trim());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
<Compile Include="SQL\KerberosTests\KerberosTest.cs" />
<Compile Include="SQL\KerberosTests\KerberosTicketManager\KerberosTicketManager.cs" />
<Compile Include="SQL\LocalDBTest\LocalDBTest.cs" />
<Compile Include="SQL\MARSSessionPoolingTest\MARSSessionPoolingTest.cs" />
<Compile Include="SQL\MARSSessionPoolingTest\MarsSessionPoolingTest.cs" />
<Compile Include="SQL\MARSTest\MARSTest.cs" />
<Compile Include="SQL\MirroringTest\ConnectionOnMirroringTest.cs" />
<Compile Include="SQL\ParallelTransactionsTest\ParallelTransactionsTest.cs" />
Expand Down

This file was deleted.

Loading
Loading