Compare commits

...

2 Commits

Author SHA1 Message Date
9aed854b1b removed github workflow
Some checks failed
Publish NuGets / build (release) Failing after 50s
2025-11-07 12:05:32 -05:00
b06acc7675 remove TestClient and update gitea workflow 2025-11-07 12:04:47 -05:00
6 changed files with 1 additions and 256 deletions

View File

@ -25,7 +25,7 @@ jobs:
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v3 uses: actions/setup-dotnet@v3
with: with:
dotnet-version: 8.x dotnet-version: 10.x
- name: Restore dependencies - name: Restore dependencies
run: dotnet restore run: dotnet restore

View File

@ -1,38 +0,0 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Publish NuGets
on:
release:
types:
- published
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Extract Release Version
id: extract_version
run: echo "RELEASE_VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
- name: Debug Release Version
run: echo "RELEASE_VERSION=${{ env.RELEASE_VERSION }}"
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x
- name: Restore dependencies
run: dotnet restore
- name: Build and Pack NuGet Package
run: dotnet pack -c Release -o ./artifacts -p:Version=${{ env.RELEASE_VERSION }}
- name: Publish to NuGet.org
run: |
dotnet nuget push ./artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}

View File

@ -1,36 +0,0 @@
#!/usr/bin/env dotnet-script
#r "nuget: Grpc.Net.Client, 2.70.0"
#r "nuget: Google.Protobuf, 3.28.3"
#r "nuget: Grpc.Tools, 2.70.0"
using Grpc.Net.Client;
using Grpc.Core;
using System;
using System.Threading.Tasks;
// We'll use reflection/dynamic to call the gRPC service
// This is a simple HTTP/2 test
var handler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};
using var channel = GrpcChannel.ForAddress("http://localhost:5000", new GrpcChannelOptions
{
HttpHandler = handler
});
Console.WriteLine("Connected to gRPC server at http://localhost:5000");
Console.WriteLine("Channel state: " + channel.State);
// Test basic connectivity
try
{
await channel.ConnectAsync();
Console.WriteLine("Successfully connected!");
}
catch (Exception ex)
{
Console.WriteLine($"Connection failed: {ex.Message}");
}

View File

@ -1,100 +0,0 @@
using Grpc.Core;
using Grpc.Net.Client;
using Svrnty.CQRS.Grpc.Sample.Grpc;
Console.WriteLine("=== gRPC Client Validation Test ===");
Console.WriteLine();
// Create a gRPC channel
using var channel = GrpcChannel.ForAddress("http://localhost:5000");
// Create the gRPC client
var client = new CommandService.CommandServiceClient(channel);
// Test 1: Valid request
Console.WriteLine("Test 1: Valid AddUser request...");
var validRequest = new AddUserCommandRequest
{
Name = "John Doe",
Email = "john.doe@example.com",
Age = 30
};
try
{
var response = await client.AddUserAsync(validRequest);
Console.WriteLine($"✓ Success! User added with ID: {response.Result}");
}
catch (RpcException ex)
{
Console.WriteLine($"✗ Unexpected error: {ex.Status.Detail}");
}
Console.WriteLine();
// Test 2: Invalid email (empty)
Console.WriteLine("Test 2: Invalid email (empty)...");
var invalidEmailRequest = new AddUserCommandRequest
{
Name = "Jane Doe",
Email = "",
Age = 25
};
try
{
var response = await client.AddUserAsync(invalidEmailRequest);
Console.WriteLine($"✗ Unexpected success! Validation should have failed.");
}
catch (RpcException ex)
{
Console.WriteLine($"✓ Validation caught! Status: {ex.StatusCode}");
Console.WriteLine($" Message: {ex.Status.Detail}");
}
Console.WriteLine();
// Test 3: Invalid email format
Console.WriteLine("Test 3: Invalid email format...");
var badEmailRequest = new AddUserCommandRequest
{
Name = "Bob Smith",
Email = "not-an-email",
Age = 40
};
try
{
var response = await client.AddUserAsync(badEmailRequest);
Console.WriteLine($"✗ Unexpected success! Validation should have failed.");
}
catch (RpcException ex)
{
Console.WriteLine($"✓ Validation caught! Status: {ex.StatusCode}");
Console.WriteLine($" Message: {ex.Status.Detail}");
}
Console.WriteLine();
// Test 4: Invalid age (0)
Console.WriteLine("Test 4: Invalid age (0)...");
var invalidAgeRequest = new AddUserCommandRequest
{
Name = "Alice Brown",
Email = "alice@example.com",
Age = 0
};
try
{
var response = await client.AddUserAsync(invalidAgeRequest);
Console.WriteLine($"✗ Unexpected success! Validation should have failed.");
}
catch (RpcException ex)
{
Console.WriteLine($"✓ Validation caught! Status: {ex.StatusCode}");
Console.WriteLine($" Message: {ex.Status.Detail}");
}
Console.WriteLine();
Console.WriteLine("All tests completed!");

View File

@ -1,58 +0,0 @@
syntax = "proto3";
option csharp_namespace = "Svrnty.CQRS.Grpc.Sample.Grpc";
package cqrs;
// Command service for CQRS operations
service CommandService {
// Adds a new user and returns the user ID
rpc AddUser (AddUserCommandRequest) returns (AddUserCommandResponse);
// Removes a user
rpc RemoveUser (RemoveUserCommandRequest) returns (RemoveUserCommandResponse);
}
// Query service for CQRS operations
service QueryService {
// Fetches a user by ID
rpc FetchUser (FetchUserQueryRequest) returns (FetchUserQueryResponse);
}
// Request message for adding a user
message AddUserCommandRequest {
string name = 1;
string email = 2;
int32 age = 3;
}
// Response message containing the added user ID
message AddUserCommandResponse {
int32 result = 1;
}
// Request message for removing a user
message RemoveUserCommandRequest {
int32 user_id = 1;
}
// Response message for remove user (empty)
message RemoveUserCommandResponse {
}
// Request message for fetching a user
message FetchUserQueryRequest {
int32 user_id = 1;
}
// Response message containing the user
message FetchUserQueryResponse {
User result = 1;
}
// User entity
message User {
int32 id = 1;
string name = 2;
string email = 3;
}

View File

@ -1,23 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Protobuf Include="Protos\*.proto" GrpcServices="Client" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.33.0" />
<PackageReference Include="Grpc.Net.Client" Version="2.71.0" />
<PackageReference Include="Grpc.Tools" Version="2.76.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>