mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 09:37:03 +00:00
cafd378859
- Start splitting tests out into own files where relevant - Improve call ordering - Use Assert.RaisesAsync where possible - Classes have been renamed (Tests is now the standard suffix) TODO: Some of the classes still need their method names changed
64 lines
1.8 KiB
C#
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 RequestContextBuilderTests
|
|
{
|
|
private CefSharpFixture fixture;
|
|
private ITestOutputHelper output;
|
|
|
|
public RequestContextBuilderTests(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);
|
|
});
|
|
}
|
|
}
|
|
}
|