Skip to content

Instantly share code, notes, and snippets.

View ByteDev's full-sized avatar
:octocat:

ByteDev

:octocat:
View GitHub Profile
@ByteDev
ByteDev / SetWallpaper.md
Last active May 11, 2021 03:52
Set a certain image to windows desktop wallpaper on system startup

Set WallPaper

Set a certain image to windows desktop wallpaper on system startup.

1. set-wallpaper.bat

Create set-wallpaper.bat:

@echo off
@ByteDev
ByteDev / NUnitNotes.md
Last active December 14, 2020 01:14
NUnit notes

NUnit Notes

Serial running

Force test class to run tests in serial.

[TestFixture]
[NonParallelizable]
@ByteDev
ByteDev / AzureTools.md
Last active September 6, 2022 06:58
Azure tools for Windows
@ByteDev
ByteDev / NUnitDotnetCoreProject.md
Last active May 20, 2021 03:33
How to quicky create a new .NET Core NUnit test project.

Creating a NUnit test project

1. Create new .NET Core project

Delete any Program.cs file that might have been automatically added to the project.

2. Edit the .csproj file

Remove:

@ByteDev
ByteDev / DevToolWebsites.md
Last active April 3, 2024 13:40
Dev Tool Websites
public class UnauthorizedResponseHandler : HttpMessageHandler
{
    protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
    {
        var response = new HttpResponseMessage(HttpStatusCode.Unauthorized);
        
        return Task.FromResult(response);
    }
}
var client = new HttpClient(new UnauthorizedResponseHandler());

var response = await client.GetAsync("https://www.google.com/");

// response.StatusCode == HttpStatusCode.Unauthorized
var mt = new MediaTypeWithQualityHeaderValue("application/json");

client.DefaultRequetHeaders.Accept.Add(mt);
var request = new HttpRequestMessage(HttpMethod.Get, "api/orders");

var mt = new MediaTypeWithQualityHeaderValue("application/json");

request.Headers.Accept.Add(mt);