Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,11 @@
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Castle.Core" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(AzureCoreSharedSources)ConnectionString.cs">
<LinkBase>Shared\Azure.Core</LinkBase>
</Compile>
</ItemGroup>

</Project>
1 change: 0 additions & 1 deletion sdk/iot/Azure.Iot.Hub.Service/tests/DevicesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public DevicesClientTests(bool isAsync)
}

[Test]
[Category("Live")]
public async Task Devices_Lifecycle()
{
// TODO: This is just a verification that tests run and it requires the tester to complete this test however they see fit.
Expand Down
14 changes: 13 additions & 1 deletion sdk/iot/Azure.Iot.Hub.Service/tests/E2eTestBase.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Net;
using Azure.Core.TestFramework;
using NUnit.Framework;
Expand All @@ -16,6 +17,7 @@ public abstract class E2eTestBase : RecordedTestBase<IotHubServiceTestEnvironmen
public E2eTestBase(bool isAsync)
: base(isAsync, TestSettings.Instance.TestMode)
{
Sanitizer = new TestConnectionStringSanitizer();
}

public E2eTestBase(bool isAsync, RecordedTestMode testMode)
Expand All @@ -34,8 +36,18 @@ public virtual void SetupE2eTestBase()

protected IoTHubServiceClient GetClient()
{
string connectionString = TestEnvironment.IotHubConnectionString;

// In playback mode we will restore the shared access key to an invalid value so the connection string can be parsed.
if (Recording.Mode == RecordedTestMode.Playback)
{
connectionString = connectionString.Replace(";SharedAccessKey=", ";SharedAccessKey=Kg==;");
}

return InstrumentClient(
new IoTHubServiceClient(TestSettings.Instance.IotHubConnectionString));
new IoTHubServiceClient(
connectionString,
Recording.InstrumentClientOptions(new IoTHubServiceClientOptions())));
}

protected string GetRandom()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ public IotHubServiceTestEnvironment()
: base("iot")
{
}

public string IotHubConnectionString => GetRecordedVariable(TestsConstants.IOT_HUB_CONNECTION_STRING);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading