Files
cefsharp/CefSharp.Test/Framework/RequestContextBuilderFacts.cs
T
Alex Maitland 3eca8bdba6 Enhancement - Simplify Setting of RequestContext Proxy (#3250)
Core - Simplify Setting of Proxy for new RequestContext

- Throw exception if requestContext.CanSetPreference returns false.
Proxy likely set via command line args.
- Add IRequestContext.SetPreferenceAsync
-  Test - Add SelfHosted Proxy
Use Titanium.Web.Proxy to self host a proxy for testing proxy settings
Only run Proxy Tests when run locally
- Add RequestContext Builder Fluent API
2020-10-13 13:40:46 +10:00

64 lines
1.8 KiB
C#

// Copyright © 2020 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
using Xunit;
using Xunit.Abstractions;
namespace CefSharp.Test.Framework
{
//NOTE: All Test classes must be part of this collection as it manages the Cef Initialize/Shutdown lifecycle
[Collection(CefSharpFixtureCollection.Key)]
public class RequestContextBuilderFacts
{
private CefSharpFixture fixture;
private ITestOutputHelper output;
public RequestContextBuilderFacts(ITestOutputHelper output, CefSharpFixture fixture)
{
this.fixture = fixture;
this.output = output;
}
[Fact]
public void ThrowExceptionWithSharedSettingsNull()
{
Assert.Throws<ArgumentNullException>(() =>
{
var requestContext = RequestContext
.Configure()
.WithSharedSettings(null);
});
}
[Fact]
public void ThrowExceptionIfContextAlreadySpecified()
{
Assert.Throws<Exception>(() =>
{
var requestContext = new RequestContext();
RequestContext
.Configure()
.WithSharedSettings(requestContext)
.WithCachePath("shouldThrowException");
});
}
[Fact]
public void ThrowExceptionIfCachePathAlreadySpecified()
{
Assert.Throws<Exception>(() =>
{
var requestContext = new RequestContext();
RequestContext
.Configure()
.WithCachePath("c:\\temp")
.WithSharedSettings(requestContext);
});
}
}
}