diff --git a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/AzureFunctions/AzureFunctionTestFiles/AzureFunctionsOutputBindingAsync.cs b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/AzureFunctions/AzureFunctionTestFiles/AzureFunctionsOutputBindingAsync.cs index 9489fe6d..094ae7b6 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/AzureFunctions/AzureFunctionTestFiles/AzureFunctionsOutputBindingAsync.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/AzureFunctions/AzureFunctionTestFiles/AzureFunctionsOutputBindingAsync.cs @@ -7,7 +7,6 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.Extensions.Logging; -using System.Collections.Generic; namespace Company.Namespace { diff --git a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/AzureFunctions/AzureFunctionsServiceTests.cs b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/AzureFunctions/AzureFunctionsServiceTests.cs index f2d99d3b..dd2e95db 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/AzureFunctions/AzureFunctionsServiceTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/AzureFunctions/AzureFunctionsServiceTests.cs @@ -6,6 +6,7 @@ using Microsoft.SqlTools.ServiceLayer.AzureFunctions; using Microsoft.SqlTools.ServiceLayer.AzureFunctions.Contracts; using Microsoft.SqlTools.ServiceLayer.Utility; +using Microsoft.SqlTools.ServiceLayer.Test.Common.Extensions; using NUnit.Framework; using System; using System.IO; @@ -39,12 +40,12 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.AzureFunctions AddSqlBindingOperation operation = new AddSqlBindingOperation(parameters); ResultStatus result = operation.AddBinding(); - Assert.True(result.Success); - Assert.IsNull(result.ErrorMessage); + Assert.That(result.Success, Is.True, "Operation should be successful"); + Assert.That(result.ErrorMessage, Is.Null, "There should be no errors"); string expectedFileText = File.ReadAllText(Path.Join(testAzureFunctionsFolder, "AzureFunctionsInputBinding.cs")); string actualFileText = File.ReadAllText(testFile); - Assert.AreEqual(expectedFileText, actualFileText); + Assert.That(expectedFileText.NormalizeLineEndings(), Is.EqualTo(actualFileText.NormalizeLineEndings())); } /// @@ -70,12 +71,12 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.AzureFunctions AddSqlBindingOperation operation = new AddSqlBindingOperation(parameters); ResultStatus result = operation.AddBinding(); - Assert.True(result.Success); - Assert.IsNull(result.ErrorMessage); + Assert.That(result.Success, Is.True, "Operation should be successful"); + Assert.That(result.ErrorMessage, Is.Null, "There should be no errors"); string expectedFileText = File.ReadAllText(Path.Join(testAzureFunctionsFolder, "AzureFunctionsOutputBinding.cs")); string actualFileText = File.ReadAllText(testFile); - Assert.AreEqual(expectedFileText, actualFileText); + Assert.That(expectedFileText.NormalizeLineEndings(), Is.EqualTo(actualFileText.NormalizeLineEndings())); } /// diff --git a/test/Microsoft.SqlTools.ServiceLayer.Test.Common/Extensions/StringExtensions.cs b/test/Microsoft.SqlTools.ServiceLayer.Test.Common/Extensions/StringExtensions.cs new file mode 100644 index 00000000..8fc80eb1 --- /dev/null +++ b/test/Microsoft.SqlTools.ServiceLayer.Test.Common/Extensions/StringExtensions.cs @@ -0,0 +1,20 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +namespace Microsoft.SqlTools.ServiceLayer.Test.Common.Extensions +{ + public static class StringExtensions + { + /// + /// Normalizes line endings, replacing all \r\n with \n. + /// + /// The string + /// The string with all line endings normalized + public static string NormalizeLineEndings(this string str) + { + return str.Replace("\r\n", "\n"); + } + } +}