* remove most net452 related code * first net4 remove * migrate test proj to net5 base * fix format * update sta xunit to fix platform not support * Squashed commit of the following: commit 16e1f819058ad281e1571b356c10d4d6ce77cf38 Author: Boshi Lian <farmer1992@gmail.com> Date: Tue Dec 8 22:42:57 2020 -0800 temp disable some version converter commit 7d1a651f4e7d27d1e61c91f46f73ac8d04ea8ab9 Author: Boshi Lian <farmer1992@gmail.com> Date: Tue Dec 8 20:55:44 2020 -0800 add missing watcher generator files commit 3f3199aad269bf89406ea71d0bc63f1a7ec23245 Author: Boshi Lian <farmer1992@gmail.com> Date: Tue Dec 8 22:14:47 2020 +0000 gen v1.20.0 * bump version to 4.0 * support empty spec * fix version converter for generator * add generated header * fix warning * rerun generator
47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
#if !NETSTANDARD2_1
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Net.WebSockets;
|
|
using System.Security.Cryptography.X509Certificates;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace k8s.Tests.Mock
|
|
{
|
|
public class MockWebSocketBuilder : WebSocketBuilder
|
|
{
|
|
public Dictionary<string, string> RequestHeaders { get; }
|
|
= new Dictionary<string, string>();
|
|
|
|
public Collection<X509Certificate2> Certificates { get; }
|
|
= new Collection<X509Certificate2>();
|
|
|
|
public Uri Uri { get; private set; }
|
|
|
|
public WebSocket PublicWebSocket => this.WebSocket;
|
|
|
|
public override WebSocketBuilder AddClientCertificate(X509Certificate2 certificate)
|
|
{
|
|
this.Certificates.Add(certificate);
|
|
return this;
|
|
}
|
|
|
|
public override Task<WebSocket> BuildAndConnectAsync(Uri uri, CancellationToken cancellationToken)
|
|
{
|
|
this.Uri
|
|
= uri;
|
|
|
|
return Task.FromResult(this.PublicWebSocket);
|
|
}
|
|
|
|
public override WebSocketBuilder SetRequestHeader(string headerName, string headerValue)
|
|
{
|
|
this.RequestHeaders.Add(headerName, headerValue);
|
|
return this;
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif // !NETSTANDARD2_1
|