public async Task ThrowsWhenNoChunkIDIsSet() { var configuration = SteamConfiguration.Create(x => x.WithHttpClientFactory(() => new HttpClient(new TeapotHttpMessageHandler()))); var steam = new SteamClient(configuration); var client = new Client(steam); var server = new Server { Protocol = Server.ConnectionProtocol.HTTP, Host = "localhost", VHost = "localhost", Port = 80 }; var chunk = new DepotManifest.ChunkData(); var ex = await Assert.ThrowsAsync <ArgumentException>(() => client.DownloadDepotChunkAsync(depotId: 0, chunk, server)); Assert.Equal("chunk", ex.ParamName); }
public async Task ThrowsSteamKitWebExceptionOnUnsuccessfulWebResponseForChunk() { var configuration = SteamConfiguration.Create(x => x.WithHttpClientFactory(() => new HttpClient(new TeapotHttpMessageHandler()))); var steam = new SteamClient(configuration); var client = new Client(steam); var server = new Server { Protocol = Server.ConnectionProtocol.HTTP, Host = "localhost", VHost = "localhost", Port = 80 }; var chunk = new DepotManifest.ChunkData { ChunkID = new byte[] { 0xFF }, }; var ex = await Assert.ThrowsAsync <SteamKitWebRequestException>(() => client.DownloadDepotChunkAsync(depotId: 0, chunk, server)); Assert.Equal(( HttpStatusCode )418, ex.StatusCode); }