Skip to content

ChatZBC/ProjectNotes

Β 
Β 

Repository files navigation

Discord
🀝 Join us

Instant Messaging App

Created as a part of Unit-Testing and Test-Driven Development excersises in class.

Table of contents

Team Members

  • Drag-NDrop
  • MachineMenace
  • GoosLife
  • Reapz
  • Daniel
  • Elexthito
  • Simon
  • PandaOnCaffeine
  • Daniel
  • Quan

Sub-teams

# Problem area Members
1 FrontEnd - UI Tue, Simon
2 BackEnd - Security features Andreas, Frederik
3 BackEnd - Profanity-filter features Anders, Martinus
4 BackEnd - SignalR info William
5 Integrations Daniel, Martin
6 Stakeholder David

Plan for testing

βœ… : Done
🟑 : In Progress
πŸ”΅ : Planned, but not started
πŸ”΄ : Awaiting plan from team

Step Team Status Area of Responsibility Test Definitions Testing methodology
Define Tests Team 1 🟑 Front-end - Username is correctly stored in a variable, so it can be passed as a header Unit test
Define Tests Team 1 βœ… Front-end - Frontend can connect to SignalR hub Unit test
Define Tests Team 1 🟑 Front-end - Frontend can send data to SignalR hub Unit test
Define Tests Team 1 πŸ”΅ Front-end - Frontend kan modtage data fra SignalR hub Unit test
Define Tests Team 2 βœ… Back-end Security - Sanitize inputs / outputs for > and < (HTML)tags Unit test
Define Tests Team 2 βœ… Back-end Security - Make sure clients can only send x messages in y time Unit test
Define Tests Team 2 πŸ”΅ Back-end Security - (later, if we get database on) santitize inputs for sql injections Unit test
Define Tests Team 3 🟑 Back-end Profanity-filter - Does the message contain any profanities Unit test
Define Tests Team 3 πŸ”΅ Back-end Profanity-filter - Is the message clean Unit test
Define Tests Team 3 πŸ”΅ Back-end Profanity-filter - Is the message empty Unit test
Define Tests Team 4 βœ… Back-end SignalR Info - SignalR get a list of users connected to the hub Unit test
Define Tests Team 4 βœ… Back-end SignalR Info - SignalR can get a username via the header, upon succesful connection Unit test
Define Tests Team 4 βœ… Back-end SignalR Info - SignalR update internal variables when it detects a client disconnect Unit test
Define Tests Team 4+5 βœ… Backend - Ensure that SignalR functions properly, so FrontEnd team can debug their connection Unit test
Define Tests Team 5 πŸ”΅ Integrations - Client can discover/ping the Backend-server and establish a successful connection Integration tests
Define Tests Team 5 βœ… Backend - SignalR - Ensure that bare minimum for SignalR is properly, loaded, along with dependencies Unit test
Define Tests Team 5 βœ… Backend - Rules engine - Ensure that bare minimum for a rules engine is properly defined(message-hook draft) Unit test
Define Tests Team 5 πŸ”΅ Integrations - Server can correctly receive an incoming message and forward it to connected clients Integration tests
Define Tests Team 5 πŸ”΅ Integrations - displays appropriate error messages for failed message sending or retrieval Integration tests

Testing progress

Step Team Status Area of Responsibility Test Definitions Testing methodology Test-function name
Write Tests Team 5 βœ… Back-end ProgramTests.cs - Test proper building of Program.cs: Adding SignalR service Unit test(Fact) ShouldAddSignalRService()
Write Tests Team 5 βœ… Back-end ProgramTests.cs - Test proper building of Program.cs: Ensure there's no problem adding Endpoints Unit test(Fact) ShouldUseEndpoints()
Write Tests Team 5 βœ… Back-end ProgramTests.cs - Test proper building of Program.cs: Ensure there's no problem setting CORS Unit test(Fact) ShouldUseCors()
Write Tests Team 5 βœ… Back-end ProgramTests.cs - Test proper building of Program.cs: Ensure there's no problem mapping the SignalR Hub Unit test(Fact) ShouldMapChatHub()
Write Tests Team 5 βœ… Back-end ProgramTests.cs - Test proper building of Program.cs: Ensure there's no problem mapping controllers Unit test(Fact) ShouldMapControllers()
Write Tests Team 5 βœ… Back-end ChatHubTests.cs - Test proper logging of messages: Ensure there's no problem logging messages Unit test(Moq assertion) ShouldLogMessage()
Write Tests Team 5 βœ… Back-end MessageCheckerTests.cs - Test proper rulechecking on messages: Check outcome in case of profanity Unit test(Theory) ShouldCheckMessage()
Write Tests Team 5 βœ… Back-end MessageCheckerTests.cs - Test proper rulechecking on messages: Check outcome in case of confanity? Unit test(Theory) ShouldCheckMessage()
Write Tests Team 5 βœ… Back-end MessageCheckerTests.cs - Test proper rulechecking on messages: Check outcome in case of security issues Unit test(Theory) ShouldCheckMessage()
Write Tests Team 5 βœ… Back-end MessageCheckerTests.cs - Test proper rulechecking on messages: Check outcome in case of chat command Unit test(Theory) ShouldCheckMessage()
Write Tests Team 5 βœ… Back-end MessageCheckerTests.cs - Test proper rulechecking on messages: Check outcome in case of a valid message Unit test(Theory) ShouldCheckMessage()
Write Tests Team 4 βœ… Back-end SignalR protokol - Info gets a list of users connected to the hub Integration test RequestUserList()
Write Tests Team 4 βœ… Back-end SignalR protokol - Get a username via header Integration test OnConnection()
Write Tests Team 4 βœ… Back-end SignalR protokol - Info - Get a list of users connected to the hub Integration test OnDisconnect()
Write Tests Team 4 βœ… Back-end SignalR protokol - Info - Sends new user to all users hub Integration test UpdateUserLists()
Write Tests Team 4 βœ… Back-end SignalR protokol - Info - Sends error to user hub Integration test SendError()

The project plan

The multi-step plan is as follows:

Step Server Client Main changes Progress Test-definitions in place
0.5 Minimal Viable Product in MVC + SignalR cshtml View Demonstrate a working example of the SignalR protocol in chat-context βœ… βœ…
1 ASP.Net Core API Angular Get a MVP up and running for group discussion and decision making 🟑 🟑
2 Entity Framework, T-SQL Angular Enable database support, to save messages, etc. And see if we can make multiple chat rooms πŸ”΅ πŸ”΄
3 Direct Message Angular Enable 1-1 confidential chats. Ensure nothing is logged or output to server console πŸ”΅ πŸ”΄

Approach

Our main focus is Test-driven Development. And this project is mainly being written, in order to practise that.

Principles

We strive to maintain a set of principles... which we've yet to decide upon πŸ€” It could be:

  • SOLID
  • Parts of SOLID like
    • Single Responsibility - Pretty relevant in order to do proper unit testing
    • Open/Close
    • Liskov Substitution
    • Interface Segregation
    • Dependency Inversion

Architecture

Intended to be a simple client/server architecture, with minimal fuzz. We mainly use SignalR and HTTP connections.

Step 1

We implement the chat UI functionality in Angular

Step 1 - Technology Stack

  • ASP.NET Core MVC
  • SignalR
  • Angular(MS)

Step 1 - Topology

graph TD
    client1(Client 1) -.-> server[Server]
    server -.-> client1
    client1 --> server
    server --> client1

    client2(Client 2) -.-> server
    server -.-> client2
    client2 --> server
    server --> client2

    client3(Client 3) -.-> server
    server -.-> client3
    client3 --> server
    server --> client3

    client4(Client 4) -.-> server
    server -.-> client4
    client4 --> server
    server --> client4

    %% Legend

    L2[ ] -. "SignalR" .-> L3[ ]
    L4[ ] -->|"HTTP"| L5[ ]

    %% Styling
    classDef legendStyle fill:#f9f9f9,stroke:#333,stroke-width:0px,color:black;
    classDef client fill:#FFA500,stroke:#000000,stroke-width:2px,color:#FFFFFF;
    classDef server fill:#000000,stroke:#1E90FF,stroke-width:4px,color:#FFFFFF;

    class L1,L2,L3,L4,L5 legendStyle;
    class client1,client2,client3,client4 client;
    class server server;


Loading

Backend

Existing Unit tests - example

Test Function Description
SendMessages(str) Tests the sending of messages function. From the server to the clients, via. SignalR
CheckProfanity(str) Tests for profanity filtering. Before the server relays messages to the clients
CheckSecurity(str) Tests the security measures. Before the server relays messages to the clients
LogMessage(str) Tests message logging. Before the server relays messages to the clients

Ideas

Suggested tests for the teams

  • Test at en SignalR Hub kan oprettes korrekt
    • Opret SignalR Hub
  • Test at en gruppe af hubs kan oprettes korrekt(f.eks. chatrooms)
    • Opret en gruppe af hubs
  • Test at en hub kan tage imod beskeder
    • Send beskeder til en hub
  • Test at beskeder bliver logget
    • Log beskeder
  • Test en besked for profanity
    • Implementer profanity filter fΓΈr serveren relayer beskeder

Constraints

Limit message sizes Send x messages in y time

Functionality ideas

Test Function Description
HighlightOwnNameMsgs @-mention's support. Highlights messages containing the users own name
ChatCommands /kick, /vote, /motd and more.. Provides ample opportunity to find more work for us

Inspiration

https://www.codeproject.com/Articles/5162436/Simple-SignalR-Server-and-Client-Applications-Demo

https://code-maze.com/netcore-signalr-angular-realtime-charts/

Suggestions for next steps:

Link to Step 2
Link to Step 3

About

H3 Classwide collab

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 52.5%
  • HTML 29.6%
  • JavaScript 9.7%
  • CSS 8.2%