[PR #633] [MERGED] Support DI and Mocking better. #1234

Open
opened 2026-01-29 16:58:45 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ElectronNET/Electron.NET/pull/633
Author: @danatcofo
Created: 12/7/2021
Status: Merged
Merged: 4/6/2022
Merged by: @GregorBiswanger

Base: masterHead: feature/DI-MOCK


📝 Commits (1)

  • 1b14bb0 Convert main static references off of Electron into interface implementation and expose the underlying Socket for low level interaction.

📊 Changes

36 files changed (+1960 additions, -18 deletions)

View changed files

📝 ElectronNET.API/App.cs (+2 -1)
ElectronNET.API/ApplicationSocket.cs (+16 -0)
📝 ElectronNET.API/AutoUpdater.cs (+2 -1)
📝 ElectronNET.API/Clipboard.cs (+2 -1)
📝 ElectronNET.API/Dialog.cs (+2 -1)
📝 ElectronNET.API/Dock.cs (+2 -1)
📝 ElectronNET.API/ElectronNET.API.csproj (+0 -0)
📝 ElectronNET.API/GlobalShortcut.cs (+2 -1)
📝 ElectronNET.API/HostHook.cs (+2 -1)
ElectronNET.API/Interfaces/IApp.cs (+713 -0)
ElectronNET.API/Interfaces/IApplicationSocket.cs (+15 -0)
ElectronNET.API/Interfaces/IAutoUpdater.cs (+146 -0)
ElectronNET.API/Interfaces/IClipboard.cs (+122 -0)
ElectronNET.API/Interfaces/IDialog.cs (+102 -0)
ElectronNET.API/Interfaces/IDock.cs (+93 -0)
ElectronNET.API/Interfaces/IGlobalShortcut.cs (+39 -0)
ElectronNET.API/Interfaces/IHostHook.cs (+30 -0)
ElectronNET.API/Interfaces/IIpcMain.cs (+65 -0)
ElectronNET.API/Interfaces/IMenu.cs (+47 -0)
ElectronNET.API/Interfaces/INativeTheme.cs (+101 -0)

...and 16 more files

📄 Description

Convert main static references off of Electron into interface implementation and expose the underlying Socket for low level interaction.

This is a utility PR to improve support for testing and also better support standard DI practices. Additionally included is exposure of the underlying Socket vie the ApplicationSocket class so that we can support more low level socket interactions without having to update the ElectronNET repo directly.

Note: I applied all the comment documentation to the interfaces but did not convert origination to use <inheritdoc /> as I felt that would be inappropriate without some feedback.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ElectronNET/Electron.NET/pull/633 **Author:** [@danatcofo](https://github.com/danatcofo) **Created:** 12/7/2021 **Status:** ✅ Merged **Merged:** 4/6/2022 **Merged by:** [@GregorBiswanger](https://github.com/GregorBiswanger) **Base:** `master` ← **Head:** `feature/DI-MOCK` --- ### 📝 Commits (1) - [`1b14bb0`](https://github.com/ElectronNET/Electron.NET/commit/1b14bb0fe56c24330c9d38d3c19ead4da27d2281) Convert main static references off of `Electron` into interface implementation and expose the underlying Socket for low level interaction. ### 📊 Changes **36 files changed** (+1960 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `ElectronNET.API/App.cs` (+2 -1) ➕ `ElectronNET.API/ApplicationSocket.cs` (+16 -0) 📝 `ElectronNET.API/AutoUpdater.cs` (+2 -1) 📝 `ElectronNET.API/Clipboard.cs` (+2 -1) 📝 `ElectronNET.API/Dialog.cs` (+2 -1) 📝 `ElectronNET.API/Dock.cs` (+2 -1) 📝 `ElectronNET.API/ElectronNET.API.csproj` (+0 -0) 📝 `ElectronNET.API/GlobalShortcut.cs` (+2 -1) 📝 `ElectronNET.API/HostHook.cs` (+2 -1) ➕ `ElectronNET.API/Interfaces/IApp.cs` (+713 -0) ➕ `ElectronNET.API/Interfaces/IApplicationSocket.cs` (+15 -0) ➕ `ElectronNET.API/Interfaces/IAutoUpdater.cs` (+146 -0) ➕ `ElectronNET.API/Interfaces/IClipboard.cs` (+122 -0) ➕ `ElectronNET.API/Interfaces/IDialog.cs` (+102 -0) ➕ `ElectronNET.API/Interfaces/IDock.cs` (+93 -0) ➕ `ElectronNET.API/Interfaces/IGlobalShortcut.cs` (+39 -0) ➕ `ElectronNET.API/Interfaces/IHostHook.cs` (+30 -0) ➕ `ElectronNET.API/Interfaces/IIpcMain.cs` (+65 -0) ➕ `ElectronNET.API/Interfaces/IMenu.cs` (+47 -0) ➕ `ElectronNET.API/Interfaces/INativeTheme.cs` (+101 -0) _...and 16 more files_ </details> ### 📄 Description Convert main static references off of `Electron` into interface implementation and expose the underlying Socket for low level interaction. This is a utility PR to improve support for testing and also better support standard DI practices. Additionally included is exposure of the underlying Socket vie the ApplicationSocket class so that we can support more low level socket interactions without having to update the ElectronNET repo directly. Note: I applied all the comment documentation to the interfaces but did not convert origination to use `<inheritdoc />` as I felt that would be inappropriate without some feedback. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 16:58:45 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#1234