Skip to content

Commit

Permalink
Merge branch 'main' into linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyhorizon2021 authored Mar 1, 2024
2 parents 0f7aeb2 + 0f3ca7d commit 97ecd35
Show file tree
Hide file tree
Showing 9 changed files with 160 additions and 85 deletions.
28 changes: 15 additions & 13 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,7 @@
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/database.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"label": "Run Backend Server",
"command": "dotnet",
"type": "process",
"args": [
Expand All @@ -36,6 +24,20 @@
"${workspaceFolder}/database.csproj"
],
"problemMatcher": "$msCompile"
},
{
"label": "Run tests",
"type": "shell",
"command": "cd Tests | dotnet test",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"reveal": "always"
},
"problemMatcher": "$msCompile"
}

]
}
54 changes: 17 additions & 37 deletions Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,21 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:40088",
"sslPort": 44351
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5135",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7086;http://localhost:5135",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:40088",
"sslPort": 44351
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"applicationUrl": "http://localhost:5135",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
}
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# GCS Database API

This is the primary codebase for the GCS database and its API.
linter
![Super-Linter](https://github.com/Northrop-Grumman-Collaboration-Project/gcs-database-api/actions/workflows/linter.yaml/badge.svg)

## To Set up WebSocket:

Expand Down Expand Up @@ -29,4 +31,32 @@ For Docker Setup:
3. `dotnet run` in console
4. Open Redis Commander and log in

![Super-Linter](https://github.com/Northrop-Grumman-Collaboration-Project/gcs-database-api/actions/workflows/linter.yaml/badge.svg)
## Running Tests
`cd Tests | dotnet test`

## [Documentation comments](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/)

### Summary
```
/**
* <summary>
* This class performs an important function.
* </summary>
*/
public class MyClass { }
```

### Summary + Parameters + Return
```
/**
* <summary>
* Enter description here for the second constructor.
* ID string generated is "M:MyNamespace.MyClass.#ctor(System.Int32)".
* </summary>
* <param name="i">Describe parameter.</param>
* <param name="ptr">Describe parameter.</param>
* <returns>Describe return value.</returns
*/
public int SomeMethod(int i, void* ptr) {return 1;}
```
main
1 change: 1 addition & 0 deletions Tests/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
global using NUnit.Framework;
23 changes: 23 additions & 0 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<IsPackable>false</IsPackable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
<PackageReference Include="NUnit.Analyzers" Version="3.6.1" />
<PackageReference Include="coverlet.collector" Version="3.2.0" />
<PackageReference Include="RestSharp" Version="110.2.0" />
</ItemGroup>

</Project>
47 changes: 25 additions & 22 deletions database.sln → Tests/Tests.sln
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "database", "database.csproj", "{CF2A5EC8-9CE9-4A0A-8515-E5D9EA8F4C4B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CF2A5EC8-9CE9-4A0A-8515-E5D9EA8F4C4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF2A5EC8-9CE9-4A0A-8515-E5D9EA8F4C4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF2A5EC8-9CE9-4A0A-8515-E5D9EA8F4C4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF2A5EC8-9CE9-4A0A-8515-E5D9EA8F4C4B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

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}") = "Tests", "Tests.csproj", "{4F660431-B27D-46C5-9140-8D8430733D59}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4F660431-B27D-46C5-9140-8D8430733D59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4F660431-B27D-46C5-9140-8D8430733D59}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F660431-B27D-46C5-9140-8D8430733D59}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4F660431-B27D-46C5-9140-8D8430733D59}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {369DC91E-96D5-453A-82D2-3B96CABF6A06}
EndGlobalSection
EndGlobal
31 changes: 31 additions & 0 deletions Tests/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System.Net;
using System.Text.Json;
using FluentAssertions;
using RestSharp;
using NUnit.Framework;

public class Tests
{
[SetUp]
public void Setup()
{
}

[Test]
public void Test1()
{

Assert.Pass();
}

[Test]
public void SearchBooks()
{
var baseUrl = "https://fakerestapi.azurewebsites.net/api/v1/Books";
RestClient client = new RestClient(baseUrl);
RestRequest restRequest = new RestRequest(baseUrl, Method.Get);
RestResponse restResponse = client.Execute(restRequest);
restResponse.Should().NotBeNull();
restResponse.StatusCode.Should().Be(HttpStatusCode.OK);
}
}
24 changes: 12 additions & 12 deletions client.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ let webSocket = new WebSocket('ws://localhost:5135/ws');

// Sample Vehicle data
let vehicleData = {
key: "Vehicle 2",
speed: 1.1,
pitch: 2.2,
yaw: 3.3,
roll: 4.4,
altitude: 5.5,
batteryLife: 6.6,
lastUpdated: "00:00:00",
currentPosition: {
latitude: 7.7,
longitude: 8.8
"key": "Vehicle 2",
"speed": 1.1,
"pitch": 2.2,
"yaw": 3.3,
"roll": 4.4,
"altitude": 5.5,
"batteryLife": 6.6,
"lastUpdated": "00:00:00",
"currentPosition": {
"latitude": 7.7,
"longitude": 8.8
},
vehicleStatus: 0
"vehicleStatus": 0
};

setTimeout(() => {
Expand Down
5 changes: 5 additions & 0 deletions database.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.8" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="RestSharp" Version="110.2.0" />
<PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
<PackageReference Include="StackExchange.Redis" Version="2.6.122" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
Expand Down

0 comments on commit 97ecd35

Please sign in to comment.