-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathAzureBlobStorageTests.cs
44 lines (38 loc) · 1.97 KB
/
AzureBlobStorageTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using Lombiq.Tests.UI.Extensions;
using Lombiq.Tests.UI.Samples.Extensions;
using System.Threading.Tasks;
using Xunit;
namespace Lombiq.Tests.UI.Samples.Tests;
// Up until now the Orchard app always used the default local Media storage for managing Media files. However, you may
// use Azure Blob Storage in production. You can also test your app with it!
public class AzureBlobStorageTests : UITestBase
{
public AzureBlobStorageTests(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
// Here we have basically two of the same tests as in BasicTests but now we're using Azure Blob Storage as the
// site's Media storage. If they still work and there are no errors in the log then the app works with Azure Blob
// Storage too.
[Fact]
public Task AnonymousHomePageShouldExistWithAzureBlobStorage() =>
ExecuteTestAfterSetupAsync(
context => context.CheckIfAnonymousHomePageExistsAsync(),
// Note the configuration! We could also set this globally in UITestBase. You'll need an accessible Azure
// Blob Storage account. For testing we recommend the Azurite emulator
// (https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azurite) that can be used from tests
// without any further configuration.
configuration => configuration.UseAzureBlobStorage = true);
[Fact]
public Task TogglingFeaturesShouldWorkWithAzureBlobStorage() =>
ExecuteTestAfterSetupAsync(
context => context.ExecuteAndAssertTestFeatureToggleAsync(),
configuration =>
{
configuration.UseAzureBlobStorage = true;
configuration.ResponseLogFilter = e =>
e.IsNonSuccessResponseAndNotExpectedNotFoundResponse(ShortcutsUITestContextExtensions.FeatureToggleTestBenchUrl);
});
}
// END OF TRAINING SECTION: Using Azure Blob Storage.
// NEXT STATION: Head over to Tests/ErrorHandlingTests.cs.