Skip to content

Commit 90fc0ae

Browse files
committed
snyk fix
1 parent a16c6a9 commit 90fc0ae

25 files changed

Lines changed: 232 additions & 280 deletions

Contentstack.Core.Tests/Contentstack.Core.Tests.csproj

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,18 @@
1313
</ItemGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
16+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
1717
<PackageReference Include="xunit" Version="2.9.2" />
1818
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
1919
<PrivateAssets>all</PrivateAssets>
2020
</PackageReference>
21-
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.0" />
22-
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.0" />
23-
<PackageReference Include="coverlet.collector" Version="6.0.2">
21+
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.18" />
22+
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.18" />
23+
<PackageReference Include="coverlet.collector" Version="6.0.4">
2424
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2525
<PrivateAssets>all</PrivateAssets>
2626
</PackageReference>
27-
<DotNetCliToolReference Include="dotnet-reportgenerator-cli" Version="4.2.10" />
28-
<PackageReference Include="AutoFixture" Version="4.18.1" />
29-
<PackageReference Include="AutoFixture.AutoMoq" Version="4.18.1" />
27+
<DotNetCliToolReference Include="dotnet-reportgenerator-cli" Version="4.2.20" />
3028
<PackageReference Include="Moq" Version="4.20.72" />
3129
</ItemGroup>
3230

Contentstack.Core.Tests/Mocks/EntryTestHelper.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Reflection;
4-
using AutoFixture;
54
using Contentstack.Core;
65
using Contentstack.Core.Configuration;
76
using Contentstack.Core.Models;
@@ -58,12 +57,11 @@ public static Entry CreateEntry(ContentstackClient client, string contentTypeId
5857
/// </summary>
5958
public static ContentstackClient CreateMockClient(string mockResponse = null)
6059
{
61-
var fixture = new Fixture();
6260
var options = new ContentstackOptions()
6361
{
64-
ApiKey = fixture.Create<string>(),
65-
DeliveryToken = fixture.Create<string>(),
66-
Environment = fixture.Create<string>()
62+
ApiKey = Guid.NewGuid().ToString("N"),
63+
DeliveryToken = Guid.NewGuid().ToString("N"),
64+
Environment = Guid.NewGuid().ToString("N")
6765
};
6866

6967
var client = new ContentstackClient(new OptionsWrapper<ContentstackOptions>(options));

Contentstack.Core.Unit.Tests/AssetLibraryUnitTests.cs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Reflection;
4-
using AutoFixture;
54
using Contentstack.Core;
65
using Contentstack.Core.Configuration;
76
using Contentstack.Core.Internals;
@@ -17,7 +16,6 @@ namespace Contentstack.Core.Unit.Tests
1716
/// </summary>
1817
public class AssetLibraryUnitTests
1918
{
20-
private readonly IFixture _fixture = new Fixture();
2119
private ContentstackClient _client;
2220

2321
public AssetLibraryUnitTests()
@@ -29,9 +27,9 @@ private void Initialize()
2927
{
3028
var options = new ContentstackOptions()
3129
{
32-
ApiKey = _fixture.Create<string>(),
33-
DeliveryToken = _fixture.Create<string>(),
34-
Environment = _fixture.Create<string>()
30+
ApiKey = Guid.NewGuid().ToString("N"),
31+
DeliveryToken = Guid.NewGuid().ToString("N"),
32+
Environment = Guid.NewGuid().ToString("N")
3533
};
3634
_client = new ContentstackClient(new OptionsWrapper<ContentstackOptions>(options));
3735
}
@@ -48,8 +46,8 @@ public void Where_AddsQueryParameter()
4846
{
4947
// Arrange
5048
var assetLibrary = CreateAssetLibrary();
51-
var key = _fixture.Create<string>();
52-
var value = _fixture.Create<string>();
49+
var key = Guid.NewGuid().ToString("N");
50+
var value = Guid.NewGuid().ToString("N");
5351

5452
// Act
5553
AssetLibrary result = assetLibrary.Where(key, value);
@@ -73,7 +71,7 @@ public void Where_WithNullKey_DoesNotAddParameter()
7371
{
7472
// Arrange
7573
var assetLibrary = CreateAssetLibrary();
76-
var value = _fixture.Create<string>();
74+
var value = Guid.NewGuid().ToString("N");
7775

7876
// Act
7977
AssetLibrary result = assetLibrary.Where(null, value);
@@ -88,7 +86,7 @@ public void Where_WithEmptyKey_DoesNotAddParameter()
8886
{
8987
// Arrange
9088
var assetLibrary = CreateAssetLibrary();
91-
var value = _fixture.Create<string>();
89+
var value = Guid.NewGuid().ToString("N");
9290

9391
// Act
9492
AssetLibrary result = assetLibrary.Where("", value);
@@ -379,8 +377,8 @@ public void AddParam_AddsQueryParameter()
379377
{
380378
// Arrange
381379
var assetLibrary = CreateAssetLibrary();
382-
var key = _fixture.Create<string>();
383-
var value = _fixture.Create<string>();
380+
var key = Guid.NewGuid().ToString("N");
381+
var value = Guid.NewGuid().ToString("N");
384382

385383
// Act
386384
AssetLibrary result = assetLibrary.AddParam(key, value);
@@ -529,7 +527,7 @@ public void SetHeaderForKey_AddsHeader()
529527
// Arrange
530528
var assetLibrary = CreateAssetLibrary();
531529
var key = "custom_header";
532-
var value = _fixture.Create<string>();
530+
var value = Guid.NewGuid().ToString("N");
533531

534532
// Act
535533
AssetLibrary result = assetLibrary.SetHeaderForKey(key, value);
@@ -552,7 +550,7 @@ public void RemoveHeader_RemovesHeader()
552550
// Arrange
553551
var assetLibrary = CreateAssetLibrary();
554552
var key = "custom_header";
555-
var value = _fixture.Create<string>();
553+
var value = Guid.NewGuid().ToString("N");
556554
assetLibrary.SetHeaderForKey(key, value);
557555

558556
var headersField = typeof(AssetLibrary).GetField("_Headers",

Contentstack.Core.Unit.Tests/AssetUnitTests.cs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Reflection;
4-
using AutoFixture;
54
using Contentstack.Core;
65
using Contentstack.Core.Configuration;
76
using Contentstack.Core.Internals;
@@ -16,7 +15,6 @@ namespace Contentstack.Core.Unit.Tests
1615
/// </summary>
1716
public class AssetUnitTests
1817
{
19-
private readonly IFixture _fixture = new Fixture();
2018
private ContentstackClient _client;
2119

2220
public AssetUnitTests()
@@ -28,9 +26,9 @@ private void Initialize()
2826
{
2927
var options = new ContentstackOptions()
3028
{
31-
ApiKey = _fixture.Create<string>(),
32-
DeliveryToken = _fixture.Create<string>(),
33-
Environment = _fixture.Create<string>()
29+
ApiKey = Guid.NewGuid().ToString("N"),
30+
DeliveryToken = Guid.NewGuid().ToString("N"),
31+
Environment = Guid.NewGuid().ToString("N")
3432
};
3533
_client = new ContentstackClient(new OptionsWrapper<ContentstackOptions>(options));
3634
}
@@ -99,7 +97,7 @@ public void GetDeleteAt_WithoutDeletedAt_ReturnsMinValue()
9997
public void GetDeletedBy_WithDeletedBy_ReturnsUid()
10098
{
10199
// Arrange
102-
var deletedBy = _fixture.Create<string>();
100+
var deletedBy = Guid.NewGuid().ToString("N");
103101
var attributes = new Dictionary<string, object>
104102
{
105103
{ "uid", "test_asset_uid" },
@@ -513,8 +511,8 @@ public void AddParam_AddsQueryParameter()
513511
{
514512
// Arrange
515513
var asset = CreateAsset();
516-
var key = _fixture.Create<string>();
517-
var value = _fixture.Create<string>();
514+
var key = Guid.NewGuid().ToString("N");
515+
var value = Guid.NewGuid().ToString("N");
518516

519517
// Act
520518
Asset result = asset.AddParam(key, value);
@@ -603,7 +601,7 @@ public void SetHeader_AddsHeader()
603601
// Arrange
604602
var asset = CreateAsset();
605603
var key = "custom_header";
606-
var value = _fixture.Create<string>();
604+
var value = Guid.NewGuid().ToString("N");
607605

608606
// Act
609607
asset.SetHeader(key, value);
@@ -623,7 +621,7 @@ public void RemoveHeader_RemovesHeader()
623621
// Arrange
624622
var asset = CreateAsset();
625623
var key = "custom_header";
626-
var value = _fixture.Create<string>();
624+
var value = Guid.NewGuid().ToString("N");
627625
asset.SetHeader(key, value);
628626

629627
var headersField = typeof(Asset).GetField("_Headers",

Contentstack.Core.Unit.Tests/ConfigUnitTests.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Linq;
33
using System.Net;
44
using System.Reflection;
5-
using AutoFixture;
65
using Contentstack.Core.Configuration;
76
using Contentstack.Core.Internals;
87
using Xunit;
@@ -11,7 +10,6 @@ namespace Contentstack.Core.Unit.Tests
1110
{
1211
public class ConfigUnitTests
1312
{
14-
private readonly IFixture _fixture = new Fixture();
1513

1614
private Config CreateConfig()
1715
{
@@ -149,7 +147,7 @@ public void Environment_Set_UpdatesValue()
149147
{
150148
// Arrange
151149
var config = CreateConfig();
152-
var environment = _fixture.Create<string>();
150+
var environment = Guid.NewGuid().ToString("N");
153151

154152
// Act
155153
config.Environment = environment;

Contentstack.Core.Unit.Tests/ContentTypeUnitTests.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Reflection;
4-
using AutoFixture;
54
using Contentstack.Core;
65
using Contentstack.Core.Configuration;
76
using Contentstack.Core.Internals;
@@ -16,7 +15,6 @@ namespace Contentstack.Core.Unit.Tests
1615
/// </summary>
1716
public class ContentTypeUnitTests
1817
{
19-
private readonly IFixture _fixture = new Fixture();
2018
private ContentstackClient _client;
2119

2220
public ContentTypeUnitTests()
@@ -28,9 +26,9 @@ private void Initialize()
2826
{
2927
var options = new ContentstackOptions()
3028
{
31-
ApiKey = _fixture.Create<string>(),
32-
DeliveryToken = _fixture.Create<string>(),
33-
Environment = _fixture.Create<string>()
29+
ApiKey = Guid.NewGuid().ToString("N"),
30+
DeliveryToken = Guid.NewGuid().ToString("N"),
31+
Environment = Guid.NewGuid().ToString("N")
3432
};
3533
_client = new ContentstackClient(new OptionsWrapper<ContentstackOptions>(options));
3634
}
@@ -46,7 +44,7 @@ private ContentType CreateContentType(string contentTypeId = "source")
4644
public void ContentTypeId_Get_ReturnsContentTypeId()
4745
{
4846
// Arrange
49-
var contentTypeId = _fixture.Create<string>();
47+
var contentTypeId = Guid.NewGuid().ToString("N");
5048
var contentType = CreateContentType(contentTypeId);
5149

5250
// Act
@@ -61,7 +59,7 @@ public void ContentTypeId_Set_UpdatesContentTypeId()
6159
{
6260
// Arrange
6361
var contentType = CreateContentType();
64-
var newContentTypeId = _fixture.Create<string>();
62+
var newContentTypeId = Guid.NewGuid().ToString("N");
6563

6664
// Act
6765
contentType.ContentTypeId = newContentTypeId;
@@ -79,7 +77,7 @@ public void Entry_WithValidUid_ReturnsEntry()
7977
{
8078
// Arrange
8179
var contentType = CreateContentType();
82-
var entryUid = _fixture.Create<string>();
80+
var entryUid = Guid.NewGuid().ToString("N");
8381

8482
// Act
8583
var entry = contentType.Entry(entryUid);
@@ -161,7 +159,7 @@ public void SetHeader_AddsHeader()
161159
// Arrange
162160
var contentType = CreateContentType();
163161
var key = "custom_header";
164-
var value = _fixture.Create<string>();
162+
var value = Guid.NewGuid().ToString("N");
165163

166164
// Act
167165
contentType.SetHeader(key, value);
@@ -180,7 +178,7 @@ public void SetHeader_WithNullKey_DoesNotAddHeader()
180178
{
181179
// Arrange
182180
var contentType = CreateContentType();
183-
var value = _fixture.Create<string>();
181+
var value = Guid.NewGuid().ToString("N");
184182
var headersField = typeof(ContentType).GetField("_Headers",
185183
BindingFlags.NonPublic | BindingFlags.Instance);
186184
var headersBefore = new Dictionary<string, object>((Dictionary<string, object>)headersField?.GetValue(contentType));
@@ -225,7 +223,7 @@ public void RemoveHeader_WithExistingKey_RemovesHeader()
225223
// Arrange
226224
var contentType = CreateContentType();
227225
var key = "test_header";
228-
var value = _fixture.Create<string>();
226+
var value = Guid.NewGuid().ToString("N");
229227

230228
var headersField = typeof(ContentType).GetField("_Headers",
231229
BindingFlags.NonPublic | BindingFlags.Instance);

Contentstack.Core.Unit.Tests/Contentstack.Core.Unit.Tests.csproj

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,18 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
1111
<PackageReference Include="xunit" Version="2.9.2" />
1212
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
1313
<PrivateAssets>all</PrivateAssets>
1414
</PackageReference>
15-
<PackageReference Include="coverlet.collector" Version="6.0.2">
15+
<PackageReference Include="coverlet.collector" Version="6.0.4">
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
<PrivateAssets>all</PrivateAssets>
1818
</PackageReference>
19-
<PackageReference Include="AutoFixture" Version="4.18.1" />
20-
<PackageReference Include="AutoFixture.AutoMoq" Version="4.18.1" />
2119
<PackageReference Include="Moq" Version="4.20.72" />
22-
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.0" />
23-
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.0" />
20+
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.18" />
21+
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.18" />
2422
</ItemGroup>
2523

2624
<ItemGroup>

0 commit comments

Comments
 (0)