Skip to content

Commit

Permalink
Merge pull request #39 from Matthew-Wise/fix/38-long-source-value
Browse files Browse the repository at this point in the history
Increased max length of source, some code clean up and fixed the text project
  • Loading branch information
Matthew-Wise authored Mar 26, 2024
2 parents 94dd4a8 + a0f50db commit d67bea2
Show file tree
Hide file tree
Showing 12 changed files with 482 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/DemoSite/DemoSite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Umbraco.Cms" Version="10.6.0" />
<PackageReference Include="Umbraco.Cms" Version="10.8.1" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 8 additions & 2 deletions src/Umbraco.Community.CSPManager.Tests/CspGlobalSetupTeardown.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// ReSharper disable once CheckNamespace

// ReSharper disable once CheckNamespace
using System.Diagnostics.CodeAnalysis;

/// <inheritdoc cref="GlobalSetupTeardown"/>
[SuppressMessage("", "S3903: Move '' into a named namespace", Justification = "We want this SetUp fixture to run on the assembly")]
[SuppressMessage("", "CA1050: Declare types in namespaces", Justification = "We want this SetUp fixture to run on the assembly")]
[SetUpFixture]
public class CspGlobalSetupTeardown : GlobalSetupTeardown
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ protected override T GetRequiredService<T>()
{
if (typeof(T) == typeof(IEventAggregator))
{
return (T)(EventAggregator = Mock.Of<IEventAggregator>());
EventAggregator = Mock.Of<IEventAggregator>();
return (T)EventAggregator;
}

return base.GetRequiredService<T>();
Expand Down Expand Up @@ -190,6 +191,25 @@ public static IEnumerable<TestCaseData> SaveCspDefinitionSource
IsBackOffice = true,
Sources = additionalSource
}) { TestName = "Add a CSP Source to a Definition" };


var longSource = CspConstants.DefaultBackOfficeCsp.ToList();
longSource.Add(new CspDefinitionSource
{
DefinitionId = CspConstants.DefaultBackofficeId,
Directives = new() { CspConstants.Directives.BaseUri },
Source = new string('a', 300)
});


yield return new TestCaseData(new CspDefinition
{
Id = CspConstants.DefaultBackofficeId,
Enabled = true,
IsBackOffice = true,
Sources = additionalSource
})
{ TestName = "Add a CSP Long Source to a Definition" };
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.6.1">
<PrivateAssets>all</PrivateAssets>
Expand Down
Loading

0 comments on commit d67bea2

Please sign in to comment.