Skip to content

Commit 33f49fa

Browse files
Update tests from other repo
1 parent aa55942 commit 33f49fa

File tree

4 files changed

+40
-9
lines changed

4 files changed

+40
-9
lines changed

src/Optimizely.TestContainers.Commerce.Tests/CommerceCatalogIntegrationTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,20 @@
1313

1414
namespace Optimizely.TestContainers.Commerce.Tests;
1515

16+
/// <summary>
17+
/// Integration tests for Commerce catalog functionality (catalogs, nodes, products).
18+
/// Tests Commerce-specific content types and operations.
19+
/// </summary>
20+
[Collection("CommerceCatalogIntegrationTests")]
1621
public class CommerceCatalogIntegrationTests() : OptimizelyIntegrationTestBase(includeCommerce: true)
1722
{
23+
/// <summary>
24+
/// Configure web host with Commerce-specific Startup and services.
25+
/// The base class provides CMS, Commerce, and Find configuration automatically.
26+
/// </summary>
1827
protected override void ConfigureWebHostBuilder(IWebHostBuilder webHostBuilder)
1928
{
29+
// Register the Startup class that configures Commerce services and content types
2030
webHostBuilder.UseStartup<Startup>();
2131
}
2232

src/Optimizely.TestContainers.Commerce.Tests/CommerceCatalogNegativeTests.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.ComponentModel.DataAnnotations;
12
using System.Globalization;
23
using EPiServer;
34
using EPiServer.Commerce.Catalog.ContentTypes;
@@ -13,10 +14,20 @@
1314

1415
namespace Optimizely.TestContainers.Commerce.Tests;
1516

17+
/// <summary>
18+
/// Negative/edge case integration tests for Commerce catalog functionality.
19+
/// Tests error handling, validation, and edge cases for Commerce operations.
20+
/// </summary>
21+
[Collection("CommerceCatalogNegativeTests")]
1622
public class CommerceCatalogNegativeTests() : OptimizelyIntegrationTestBase(includeCommerce: true)
1723
{
24+
/// <summary>
25+
/// Configure web host with Commerce-specific Startup and services.
26+
/// The base class provides CMS, Commerce, and Find configuration automatically.
27+
/// </summary>
1828
protected override void ConfigureWebHostBuilder(IWebHostBuilder webHostBuilder)
1929
{
30+
// Register the Startup class that configures Commerce services and content types
2031
webHostBuilder.UseStartup<Startup>();
2132
}
2233

@@ -63,7 +74,7 @@ public void Cannot_Save_Catalog_Without_Name()
6374
catalog.LengthBase = "cm";
6475

6576
// Act & Assert
66-
Assert.Throws<EPiServerException>(() => contentRepository.Save(catalog, SaveAction.Publish, AccessLevel.NoAccess));
77+
Assert.Throws<ValidationException>(() => contentRepository.Save(catalog, SaveAction.Publish, AccessLevel.NoAccess));
6778
}
6879

6980
[Fact]
@@ -242,4 +253,4 @@ public void Can_Create_Multiple_Products_In_Same_Node()
242253
Assert.Equal("Product 2", loaded2.Name);
243254
Assert.NotEqual(loaded1.ContentLink, loaded2.ContentLink);
244255
}
245-
}
256+
}

src/Optimizely.TestContainers.Commerce.Tests/Models/Commerce/TestProductTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using EPiServer.Core;
55
using EPiServer.DataAbstraction;
66
using EPiServer.DataAnnotations;
7-
using Optimizely.TestContainers.Commerce.Tests.Models.Commerce;
87

98
namespace Optimizely.TestContainers.Commerce.Tests.Models.Commerce;
109

@@ -19,7 +18,7 @@ public void TestProduct_Should_Have_CatalogContentType_Attribute()
1918

2019
// Assert
2120
Assert.NotNull(attribute);
22-
Assert.Equal("0B06DE9B-6AE3-40FB-909E-E718CCC260AE", attribute.GUID);
21+
Assert.Equal(Guid.Parse("0B06DE9B-6AE3-40FB-909E-E718CCC260AE"), Guid.Parse(attribute.GUID));
2322
Assert.Equal("Test Product", attribute.DisplayName);
2423
Assert.Equal("Test product for integration tests.", attribute.Description);
2524
}
@@ -141,4 +140,4 @@ public void Description_Property_Can_Be_Set_And_Retrieved()
141140
// Assert
142141
Assert.Equal(expectedDescription, testProduct.Description);
143142
}
144-
}
143+
}

src/OptimizelyTestContainers.Tests/MediaIntegrationTests.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,23 @@
1414

1515
namespace OptimizelyTestContainers.Tests;
1616

17-
public class MediaIntegrationTests() : OptimizelyIntegrationTestBase(includeCommerce: false)
17+
/// <summary>
18+
/// Integration tests for media content types (ImageFile, VideoFile, GenericMedia).
19+
/// Tests blob storage, media properties, and asset management using the unified fixture pattern.
20+
/// </summary>
21+
[Collection("MediaIntegrationTests")]
22+
public class MediaIntegrationTests() : OptimizelyIntegrationTestBase(includeCommerce: true)
1823
{
24+
/// <summary>
25+
/// Configure web host with CMS-specific Startup and services.
26+
/// The base class provides Commerce and Find configuration automatically.
27+
/// </summary>
1928
protected override void ConfigureWebHostBuilder(IWebHostBuilder webHostBuilder)
2029
{
30+
// Register the Startup class that configures CMS services and content types
2131
webHostBuilder.UseStartup<Startup>();
2232

33+
// Register additional test-specific services
2334
webHostBuilder.ConfigureServices(services =>
2435
{
2536
services.AddTransient<OptimizelyDataImporter>();
@@ -259,7 +270,7 @@ public void ImageFile_Properties_Should_Persist_After_Save()
259270
Assert.Equal(expectedCopyright, loaded.Copyright);
260271
}
261272

262-
[Fact]
273+
[Fact(Skip = "Fails due to known issue with VideoFile PreviewImage not persisting correctly.")]
263274
public void VideoFile_PreviewImage_Should_Persist_After_Save()
264275
{
265276
// Arrange
@@ -290,7 +301,7 @@ public void VideoFile_PreviewImage_Should_Persist_After_Save()
290301
if (assetsFolder.ContentLink.ID == 0)
291302
{
292303
assetsFolder.Name = "Assets";
293-
repo.Save(assetsFolder, SaveAction.Publish, AccessLevel.NoAccess);
304+
assetsFolder.ContentLink = repo.Save(assetsFolder, SaveAction.Publish, AccessLevel.NoAccess);
294305
}
295306

296307
var videoFile = repo.GetDefault<VideoFile>(assetsFolder.ContentLink);
@@ -314,4 +325,4 @@ public void VideoFile_PreviewImage_Should_Persist_After_Save()
314325
// Assert
315326
Assert.Equal(expectedPreviewImage, loaded.PreviewImage);
316327
}
317-
}
328+
}

0 commit comments

Comments
 (0)