-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MTTL 1117 #1
Open
humulla
wants to merge
20
commits into
main
Choose a base branch
from
MTTL-1117
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
MTTL 1117 #1
Changes from 15 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
9f482b3
Nuget release
humulla 0e8fca6
circle config
humulla aeff287
Add .circleci/config.yml
humulla da8d838
solving version issue
humulla dbbe271
Merge branch 'MTTL-1117' of https://github.com/LBHackney-IT/Hackney.S…
humulla 526f8d0
shared contact details
humulla 79e7e52
updated config
humulla 4824875
docker file casing rename
humulla 8e16f1b
temp dockerfile delete
humulla f8b1265
dockerfile added in
humulla 73eee89
PR template added
humulla 2510253
Readme updated
humulla 3e9dd34
codeowners added
humulla 725ce06
gitignore file
humulla 53651c6
csproj repo name changed
humulla ebad369
PR changes
humulla 823aee1
removed test from pipeline
humulla d515b26
commented build and test from pipline as there are no tests
humulla 68cf898
Remove files from gitignore
notatiyyah 9b81821
Switch to GH Actions for auto versioning
notatiyyah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
nuget-cache: guitarrapc/[email protected] | ||
aws-ecr: circleci/[email protected] | ||
|
||
executors: | ||
docker-dotnet: | ||
docker: | ||
- image: mcr.microsoft.com/dotnet/core/sdk:3.1 | ||
docker-python: | ||
docker: | ||
- image: circleci/python:3.7 | ||
|
||
references: | ||
workspace_root: &workspace_root "~" | ||
attach_workspace: &attach_workspace | ||
attach_workspace: | ||
at: *workspace_root | ||
|
||
jobs: | ||
check-code-formatting: | ||
executor: docker-dotnet | ||
steps: | ||
- checkout | ||
- run: | ||
name: Install dotnet format | ||
command: dotnet tool install dotnet-format --tool-path ./dotnet-format-local/ | ||
- run: | ||
name: Run formatter check | ||
command: ./dotnet-format-local/dotnet-format --check | ||
build-and-test: | ||
executor: docker-python | ||
steps: | ||
- checkout | ||
- setup_remote_docker | ||
- run: | ||
name: build | ||
command: docker-compose build hackney-shared-contact-details-test | ||
- run: | ||
name: Run tests | ||
command: docker-compose run hackney-shared-contact-details-test | ||
publish-package: | ||
executor: docker-dotnet | ||
steps: | ||
- checkout | ||
- *attach_workspace | ||
- run: | ||
name: Release the Package | ||
command: | | ||
cd ./Hackney.Shared.ContactDetails | ||
dotnet pack --configuration Release | ||
- run: | ||
name: Publish to GitHub | ||
command: | | ||
cd /root/project/Hackney.Shared.ContactDetails/bin/Release | ||
dotnet nuget push Hackney.Shared.ContactDetails.*.nupkg -s https://nuget.pkg.github.com/LBHackney-IT/index.json --api-key ${NUGET_KEY} Hackney.Shared.ContactDetails.*/*.nupkg | ||
workflows: | ||
nuget-package: | ||
jobs: | ||
- check-code-formatting | ||
- build-and-test | ||
- publish-package: | ||
requires: | ||
- build-and-test | ||
filters: | ||
branches: | ||
only: main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#Junk Files | ||
*.DS_Store | ||
[Tt]humbs.db | ||
|
||
#Visual Studio Files | ||
[Oo]bj | ||
[Bb]in | ||
[Dd]ebug | ||
[Bb]uild/ | ||
*.user | ||
*.suo | ||
*.exe | ||
*.pdb | ||
*.aps | ||
*_i.c | ||
*_p.c | ||
*.ncb | ||
*.tlb | ||
*.tlh | ||
*.[Cc]ache | ||
*.bak | ||
*.ncb | ||
*.ilk | ||
*.log | ||
*.lib | ||
*.sbr | ||
*.sdf | ||
ipch/ | ||
*.dbmdl | ||
*.csproj.user | ||
*.cache | ||
*.swp | ||
*.vspscc | ||
*.vssscc | ||
*.bak.* | ||
*.bak | ||
|
||
#Tools | ||
_ReSharper.* | ||
_ReSharper*/ | ||
*.resharper | ||
*.resharper.user | ||
[Nn][Dd]epend[Oo]ut*/ | ||
Ankh.NoLoad | ||
|
||
#Other | ||
.svn | ||
|
||
# Include DLLs if they're in the NuGet packages directory | ||
!/packages/*/lib/*.dll | ||
!/packages/*/lib/*/*.dll | ||
|
||
# Ignore master key for decrypting credentials and more. | ||
/config/master.key | ||
|
||
obj/ | ||
out/ | ||
bin/ | ||
.idea/ | ||
tmp/ | ||
.vs/ | ||
/Hackney.Shared.ContactDetails.Tests/Properties/launchSettings.json | ||
|
||
.fake | ||
.ionide | ||
|
||
*.nupkg | ||
testresults/ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"CurrentProjectSetting": null | ||
} |
Binary file not shown.
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# doc for this file https://help.github.com/articles/about-code-owners/ | ||
|
||
# These owners will be the default owners for everything in | ||
# the repo. Unless a later match takes precedence, | ||
# @global-owner1 and @global-owner2 will be requested for | ||
# review when someone opens a pull request. | ||
|
||
* @LBHMGeorgieva @LBHMKeyworth @LBHSPreston @LBHRShetty @mtfh-manage-my-home |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 | ||
|
||
# disable microsoft telematry | ||
ENV DOTNET_CLI_TELEMETRY_OPTOUT='true' | ||
|
||
WORKDIR /app | ||
|
||
# Copy csproj and restore as distinct layers | ||
COPY ./Hackney.Shared.ContactDetails.sln ./ | ||
COPY ./Hackney.Shared.ContactDetails/Hackney.Shared.ContactDetails.csproj ./Hackney.Shared.ContactDetails/ | ||
COPY ./Hackney.Shared.ContactDetails.Tests/Hackney.Shared.ContactDetails.Tests.csproj ./Hackney.Shared.ContactDetails.Tests/ | ||
|
||
RUN dotnet restore ./Hackney.Shared.ContactDetails/Hackney.Shared.ContactDetails.csproj | ||
RUN dotnet restore ./Hackney.Shared.ContactDetails.Tests/Hackney.Shared.ContactDetails.Tests.csproj | ||
|
||
# Copy everything else and build | ||
COPY . . | ||
|
||
RUN dotnet build -c debug -o out Hackney.Shared.ContactDetails.Tests/Hackney.Shared.ContactDetails.Tests.csproj | ||
|
||
CMD dotnet test |
35 changes: 35 additions & 0 deletions
35
Hackney.Shared.ContactDetails.Tests/Hackney.Shared.ContactDetails.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
|
||
<IsPackable>false</IsPackable> | ||
<NoWarn>CA1303;CA1305;CA1001;CA1062;CA1307</NoWarn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Remove="TestResults\**" /> | ||
<EmbeddedResource Remove="TestResults\**" /> | ||
<None Remove="TestResults\**" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AutoFixture" Version="4.17.0" /> | ||
<PackageReference Include="coverlet.collector" Version="1.2.0" /> | ||
<PackageReference Include="coverlet.msbuild" Version="3.0.3"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="FluentAssertions" Version="5.10.3" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" /> | ||
<PackageReference Include="Moq" Version="4.16.1" /> | ||
<PackageReference Include="xunit" Version="2.4.0" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Hackney.Shared.ContactDetails\Hackney.Shared.ContactDetails.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
88 changes: 88 additions & 0 deletions
88
Hackney.Shared.ContactDetails.Tests/SNS/SnsGatewayTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
using Amazon.SimpleNotificationService; | ||
using Amazon.SimpleNotificationService.Model; | ||
using AutoFixture; | ||
using FluentAssertions; | ||
using Hackney.Shared.ContactDetails.Sns; | ||
using Moq; | ||
using System; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace Hackney.Shared.ContactDetails.Tests.Sns | ||
{ | ||
public class SnsGatewayTests | ||
{ | ||
private readonly Fixture _fixture = new Fixture(); | ||
private readonly Mock<IAmazonSimpleNotificationService> _mockAwsSns; | ||
private readonly SnsGateway _sut; | ||
private readonly SnsTestMessage _message; | ||
private readonly JsonSerializerOptions _jsonOptions; | ||
|
||
private readonly string _topic = "some-topic"; | ||
private readonly string _group = "some-group"; | ||
|
||
public SnsGatewayTests() | ||
{ | ||
_mockAwsSns = new Mock<IAmazonSimpleNotificationService>(); | ||
_sut = new SnsGateway(_mockAwsSns.Object); | ||
_message = _fixture.Create<SnsTestMessage>(); | ||
_jsonOptions = CreateJsonOptions(); | ||
} | ||
|
||
private static JsonSerializerOptions CreateJsonOptions() | ||
{ | ||
var options = new JsonSerializerOptions | ||
{ | ||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase, | ||
WriteIndented = true | ||
}; | ||
options.Converters.Add(new JsonStringEnumConverter()); | ||
return options; | ||
} | ||
|
||
private static bool VerifyPublishRequest(PublishRequest actual, string expectedMsgJson, string expectedTopic, string expectedGroup) | ||
{ | ||
actual.Message.Should().Be(expectedMsgJson); | ||
actual.TopicArn.Should().Be(expectedTopic); | ||
actual.MessageGroupId.Should().Be(expectedGroup); | ||
return true; | ||
} | ||
|
||
[Fact] | ||
public void PublishTestNullSnsObjectThrows() | ||
{ | ||
Func<Task> func = async () => await _sut.Publish<SnsTestMessage>(null, _topic, _group).ConfigureAwait(false); | ||
func.Should().Throw<ArgumentNullException>(); | ||
} | ||
|
||
[Theory] | ||
[InlineData(null)] | ||
[InlineData("")] | ||
public void PublishTestNullTopicArnThrows(string topic) | ||
{ | ||
Func<Task> func = async () => await _sut.Publish<SnsTestMessage>(_message, topic, _group).ConfigureAwait(false); | ||
func.Should().Throw<ArgumentNullException>(); | ||
} | ||
|
||
[Theory] | ||
[InlineData(null)] | ||
[InlineData("")] | ||
[InlineData("a_group")] | ||
public async Task PublishTestPublishesMessageToTopic(string group) | ||
{ | ||
var msgJson = JsonSerializer.Serialize(_message, _jsonOptions); | ||
await _sut.Publish<SnsTestMessage>(_message, _topic, group).ConfigureAwait(false); | ||
|
||
_mockAwsSns.Verify(x => x.PublishAsync(It.Is<PublishRequest>(y => VerifyPublishRequest(y, msgJson, _topic, group)), default), Times.Once); | ||
} | ||
} | ||
|
||
public class SnsTestMessage | ||
{ | ||
public Guid Id { get; set; } | ||
public string Name { get; set; } | ||
public DateTime Date { get; set; } | ||
} | ||
} |
Binary file added
BIN
+1.05 MB
Hackney.Shared.ContactDetails.Tests/bin/Debug/netcoreapp3.1/AWSSDK.Core.dll
Binary file not shown.
Binary file added
BIN
+170 KB
....Shared.ContactDetails.Tests/bin/Debug/netcoreapp3.1/AWSSDK.SimpleNotificationService.dll
Binary file not shown.
Binary file added
BIN
+194 KB
Hackney.Shared.ContactDetails.Tests/bin/Debug/netcoreapp3.1/AutoFixture.dll
Binary file not shown.
Binary file added
BIN
+273 KB
Hackney.Shared.ContactDetails.Tests/bin/Debug/netcoreapp3.1/Castle.Core.dll
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+446 KB
Hackney.Shared.ContactDetails.Tests/bin/Debug/netcoreapp3.1/FluentAssertions.dll
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can stay in LBH-Core