Skip to content

Commit

Permalink
updates to frontend and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
madebygps committed Dec 11, 2023
1 parent d7cfce6 commit 33aee3f
Show file tree
Hide file tree
Showing 220 changed files with 14,630 additions and 742 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/tests/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/workspace/tests",
"workspaceFolder": "/workspace/Api.Function.Tests",

// Features to add to the dev container. More info: https://containers.dev/features.

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/frontend.main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
with:
azcliversion: 2.30.0
inlineScript: |
az cdn endpoint purge --content-paths "/*" --profile-name "CloudResumeChallengeGPS" --name "cloudresumechallengegps" --resource-group "cloud-resume-challenge-rg"
az cdn endpoint purge --content-paths "/*" --profile-name "CloudResumeChallengeGPS" --name "gpsazuresume" --resource-group "cloud-resume-challenge-rg"
# Azure logout
- name: logout
Expand Down
60 changes: 31 additions & 29 deletions tests/tests.csproj → Api.Function.Tests/Api.Function.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\api\api.csproj" />
</ItemGroup>


</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\api\api.csproj" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions Api.Function.Tests/Api.Function.Tests.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Api.Function.Tests", "Api.Function.Tests.csproj", "{DBC27DB4-3ABD-4BDE-956D-56CC850D28A4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DBC27DB4-3ABD-4BDE-956D-56CC850D28A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DBC27DB4-3ABD-4BDE-956D-56CC850D28A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DBC27DB4-3ABD-4BDE-956D-56CC850D28A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DBC27DB4-3ABD-4BDE-956D-56CC850D28A4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {33F335DF-A961-40E8-8CB0-CB9E7BF3B61E}
EndGlobalSection
EndGlobal
37 changes: 37 additions & 0 deletions Api.Function.Tests/GetVisitorCounterTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Microsoft.Extensions.Logging;
using NSubstitute;
using FluentAssertions;
using Microsoft.Extensions.Logging.Abstractions;

namespace Api.Function.Tests.Unit
{
public class GetVisitorCounterTests
{
private readonly GetVisitorCounter _sut;
private readonly ILogger<GetVisitorCounter> _logger = NullLogger<GetVisitorCounter>.Instance;
private readonly IVisitorCounterService _mockCounterService = Substitute.For<IVisitorCounterService>();

public GetVisitorCounterTests()
{
_sut = new GetVisitorCounter(_logger, _mockCounterService);
}

// Test methods...

[Fact]
public void IncrementCounter_ShouldIncrementCount()
{
// Arrange
var service = new VisitorCounterService();
var counter = new Counter("index", 1);

// Act
var updatedCounter = service.IncrementCounter(counter);

// Assert
updatedCounter.Count.Should().Be(2);
}
}


}
2 changes: 2 additions & 0 deletions Api.Function.Tests/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
global using Xunit;
global using Api.Function;
10 changes: 10 additions & 0 deletions Api.Function.Tests/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Api.Function.Tests;

public class UnitTest1
{
[Fact]
public void Test1()
{

}
}
Loading

0 comments on commit 33aee3f

Please sign in to comment.