# farahchannir/testwork architecture

> Architecture diagram of the GitHub repository farahchannir/testwork, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/farahchannir/testwork
- Repository: https://github.com/farahchannir/testwork

## Overview

This repository implements a TCP/JSON-RPC auction client and server, plus a console simulator that exercises them. In the interactive workflow, a user chooses to start an auction or place a bid; the client invokes the server, which registers auction products or broadcasts bids to connected clients. The server also exposes product and auction-conclusion notifications, with client-side handlers for updates and winners. The sampled server code does not show a bid-validation or auction-closing trigger, and its product-price notification handler is not present in the excerpts, so those connections are not inferred.

Main entry points: [`Auction-Client/Models/AuctionClient.cs`](https://github.com/farahchannir/testwork/blob/master/Auction-Client/Models/AuctionClient.cs) (Client RPC), [`Auction-Server/Models/AuctionServer.cs`](https://github.com/farahchannir/testwork/blob/master/Auction-Server/Models/AuctionServer.cs) (RPC and auctions), [`P2PAuctionSimulator/Program.cs`](https://github.com/farahchannir/testwork/blob/master/P2PAuctionSimulator/Program.cs) (Scenario runner), [`Auction-Client/Program.cs`](https://github.com/farahchannir/testwork/blob/master/Auction-Client/Program.cs) (Interactive menu)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Auction client"]
  node_client_entry["Interactive menu<br/>[Program.cs]"]
  node_client_rpc["Client RPC<br/>[AuctionClient.cs]"]
  node_client_state[("Client state<br/>[AuctionClient.cs]")]
end

subgraph group_server["Auction server"]
  node_server_entry["Server startup<br/>[Program.cs]"]
  node_server_rpc["RPC and auctions<br/>[AuctionServer.cs]"]
  node_server_state[("Auction state<br/>[AuctionServer.cs]")]
  node_bid_model["Bid record<br/>[Bid.cs]"]
end

subgraph group_simulator["Simulation"]
  node_sim_entry["Scenario runner<br/>[Program.cs]"]
end

node_user(("Console user"))

node_user -->|"chooses actions"| node_client_entry
node_client_entry -->|"starts or bids"| node_client_rpc
node_client_rpc -->|"invokes RPC"| node_server_rpc
node_server_entry -->|"starts listener"| node_server_rpc
node_server_rpc -->|"updates state"| node_server_state
node_server_rpc -->|"notifies clients"| node_client_rpc
node_client_rpc -->|"records winners"| node_client_state
node_sim_entry -->|"starts server"| node_server_rpc
node_sim_entry -->|"runs scenario"| node_client_rpc

click node_client_entry "https://github.com/farahchannir/testwork/blob/master/Auction-Client/Program.cs"
click node_client_rpc "https://github.com/farahchannir/testwork/blob/master/Auction-Client/Models/AuctionClient.cs"
click node_client_state "https://github.com/farahchannir/testwork/blob/master/Auction-Client/Models/AuctionClient.cs"
click node_server_entry "https://github.com/farahchannir/testwork/blob/master/Auction-Server/Program.cs"
click node_server_rpc "https://github.com/farahchannir/testwork/blob/master/Auction-Server/Models/AuctionServer.cs"
click node_server_state "https://github.com/farahchannir/testwork/blob/master/Auction-Server/Models/AuctionServer.cs"
click node_bid_model "https://github.com/farahchannir/testwork/blob/master/Auction-Server/Models/Bid.cs"
click node_sim_entry "https://github.com/farahchannir/testwork/blob/master/P2PAuctionSimulator/Program.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client_entry,node_client_rpc,node_client_state,node_user toneBlue
class node_server_entry,node_server_rpc,node_server_state,node_bid_model toneAmber
class node_sim_entry toneMint
```

## Components

### Auction client

- [Interactive menu](https://github.com/farahchannir/testwork/blob/master/Auction-Client/Program.cs): `Auction-Client/Program.cs`
- [Client RPC](https://github.com/farahchannir/testwork/blob/master/Auction-Client/Models/AuctionClient.cs): `Auction-Client/Models/AuctionClient.cs`
- [Client state](https://github.com/farahchannir/testwork/blob/master/Auction-Client/Models/AuctionClient.cs): `Auction-Client/Models/AuctionClient.cs`

### Auction server

- [Server startup](https://github.com/farahchannir/testwork/blob/master/Auction-Server/Program.cs): `Auction-Server/Program.cs`
- [RPC and auctions](https://github.com/farahchannir/testwork/blob/master/Auction-Server/Models/AuctionServer.cs): `Auction-Server/Models/AuctionServer.cs`
- [Auction state](https://github.com/farahchannir/testwork/blob/master/Auction-Server/Models/AuctionServer.cs): `Auction-Server/Models/AuctionServer.cs`
- [Bid record](https://github.com/farahchannir/testwork/blob/master/Auction-Server/Models/Bid.cs): `Auction-Server/Models/Bid.cs`

### Simulation

- [Scenario runner](https://github.com/farahchannir/testwork/blob/master/P2PAuctionSimulator/Program.cs): `P2PAuctionSimulator/Program.cs`

### Other components

- **Console user**

## Connections

- Console user → Interactive menu: chooses actions
- Interactive menu → Client RPC: starts or bids
- Client RPC → RPC and auctions: invokes RPC
- Server startup → RPC and auctions: starts listener
- RPC and auctions → Auction state: updates state
- RPC and auctions → Client RPC: notifies clients
- Client RPC → Client state: records winners
- Scenario runner → RPC and auctions: starts server
- Scenario runner → Client RPC: runs scenario
