MCAuth.Testing 1.0.2

dotnet add package MCAuth.Testing --version 1.0.2
                    
NuGet\Install-Package MCAuth.Testing -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MCAuth.Testing" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MCAuth.Testing" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="MCAuth.Testing" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MCAuth.Testing --version 1.0.2
                    
#r "nuget: MCAuth.Testing, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MCAuth.Testing@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MCAuth.Testing&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=MCAuth.Testing&version=1.0.2
                    
Install as a Cake Tool

MCAuth.Testing

Testing library for MCAuth. This is used for testing purposes only. It automatically mocks HTTP requests made by the library and returns a custom response provided by you.

Usage

The only difference from the main library is the initial creation of the client. You must set up your mock responses for authentication to return a successful response. The bare minimum that is required for your mock is the microsoft login code, redirect URL, Minecraft ID, and Minecraft username. Here is an example of that:

var code = "M.C503_AB1.2.U.01234567-89ab-cdef-0123-456789abcdef";
var redirectUrl = "https://my-app.com/login";
var client = new MCAuthTestClient("AZURE_CLIENT_ID", "AZURE_CLIENT_SECRET")
  .WithAllowedValues(new List<MCAuthTestAllowedAuth> {
    new MCAuthTestAllowedAuth(code, redirectUrl, "MINECRAFT_ID", "MINECRAFT_USERNAME");
  });

And here is an example of a mock which provides all possible values:

var code = "M.C503_AB1.2.U.01234567-89ab-cdef-0123-456789abcdef";
var redirectUrl = "https://my-app.com/login";
var client = new MCAuthTestClient("AZURE_CLIENT_ID", "AZURE_CLIENT_SECRET")
  .WithAllowedValues(new List<MCAuthTestAllowedAuth> {
    new MCAuthTestAllowedAuth(
      code,
      redirectUrl,
      new MCAuthTestResponse(new MinecraftProfileAuthTestResponse("MINECRAFT_ID", "MINECRAFT_USERNAME") {
        Capes = ImmutableList<MinecraftProfileAuthCape>.Empty.Add(new MinecraftProfileAuthCape {
          Id = "00000000-1111-2222-3333-444444444444",
          State = "ACTIVE",
          Url = $"{MCAuthConstants.MinecraftTexturesAddress.ToString()}/fedcba09876543211234567890abcdeffedcba09876543211234567890abcdef",
          Alias = "TestCape"
        }),
        Skins = ImmutableList<MinecraftProfileAuthSkin>.Empty.Add(new MinecraftProfileAuthSkin {
          Id = "11111111-2222-3333-4444-555555555555",
          State = "ACTIVE",
          Url = $"{MCAuthConstants.MinecraftTexturesAddress.ToString()}/1234567890abcdeffedcba09876543211234567890abcdeffedcba0987654321",
          TextureKey = "1234567890abcdeffedcba09876543211234567890abcdeffedcba0987654321",
          Variant = "CLASSIC",
          Alias = null
        })
      }) {
        MicrosoftToken = new MicrosoftAuthTestTokenResponse {
          UserId = "22222222-3333-4444-5555-666666666666",
          Foci = ""
        },
        XboxLiveToken = new XboxLiveAuthTestTokenResponse {
          Uhs = "1234567890"
        },
        MinecraftToken = new MinecraftAuthTestTokenResponse {
          Username = "33333333-4444-5555-6666-777777777777",
          Roles = ImmutableList<object>.Empty.Add("TestRole"),
          Metadata = ImmutableDictionary<string, object>.Empty.Add("TestMetadata", 1234)
        }
      }
    );
  });
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 36 2/19/2026

Initial 1.0.0 release