Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
shishnk committed Apr 14, 2024
1 parent 0ff9038 commit 3cda8ca
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 13 deletions.
31 changes: 19 additions & 12 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,30 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build
run: dotnet build
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build
run: dotnet build

tests:
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Test WeatherApp
run: dotnet test ./WeatherBotApi.WeatherApp/Tests/WeatherApp.Tests/WeatherApp.Tests.csproj --verbosity normal
- name: Test WeatherApp
run: dotnet test ./WeatherBotApi.WeatherApp/Tests/WeatherApp.Tests/WeatherApp.Tests.csproj --verbosity normal /p:CollectCoverage=true /p:CoverletOutput=../../../TestResults/

- name: Test DatabaseApp
run: dotnet test ./WeatherBotApi.DatabaseApp/Tests/DatabaseApp.Tests/DatabaseApp.Tests.csproj --verbosity normal
- name: Test DatabaseApp
run: dotnet test ./WeatherBotApi.DatabaseApp/Tests/DatabaseApp.Tests/DatabaseApp.Tests.csproj --verbosity normal /p:CollectCoverage=true /p:CoverletOutput=../../../TestResults/ /p:MergeWith=../../../TestResults/coverage.json /p:CoverletOutputFormat=lcov

- name: Publish coverage report
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: './TestResults/coverage.info'
format: lcov
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[![License](https://img.shields.io/badge/license-MIT-green?style=for-the-badge)](./LICENSE)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/shishnk/weather-bot-api/dotnet.yml?style=for-the-badge&label=BUILD%2FTESTS)
![Coveralls](https://img.shields.io/coverallsCoverage/github/shishnk/weather-bot-api?style=for-the-badge)
![Website](https://img.shields.io/website?url=https%3A%2F%2Fwttr.in%2F&style=for-the-badge&label=wttr.in)

# WeatherBotApi

## Overview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="7.0.0-alpha.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ public async Task<Result<string>> Execute(InvocationContext context,
return "Invalid format for resend interval. Please use the format hh:mm".ToResult();
}

if (minutes > 59) return "Minutes should be less than 60".ToResult();

var resendInterval = new TimeSpan(hours, minutes, 0);

if (resendInterval < TimeSpan.FromMinutes(30)) // hardcode
Expand Down Expand Up @@ -169,7 +171,7 @@ await cacheService.GetAsync<List<UserSubscriptionInfo>>("allSubscriptions",
{
var subscription = userSubscriptions[i];
message.AppendLine(
$"{i + 1}) Location: {subscription.Location}, resend interval: {subscription.ResendInterval.ToString(@"hh\:mm")}");
$"{i + 1}) Location: {subscription.Location}, resend interval: {(int)subscription.ResendInterval.TotalHours}:{subscription.ResendInterval.Minutes}");
}

return message.Length > 0
Expand Down Expand Up @@ -219,6 +221,8 @@ public async Task<Result<string>> Execute(InvocationContext context,
return "Invalid format for resend interval. Please use the format hh:mm".ToResult();
}

if (minutes > 59) return "Minutes should be less than 60".ToResult();

var resendInterval = new TimeSpan(hours, minutes, 0);

if (resendInterval < TimeSpan.FromMinutes(30)) // hardcode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="7.0.0-alpha.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0-preview-24080-01" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
Expand Down

0 comments on commit 3cda8ca

Please sign in to comment.