The presence of problems associated with the execution of the Link to the project in the Visual Studio 2017 Runner test. Unit Test CSPROJ builds just fine with TargetFramework=net47, but at run time we get the following message from MSTEST or XUNIT. Using Microsoft.NET.Test.Sdkv15.0.0.
Test Run Error (x86): Serilog Seq Extension
System.MissingMethodException: Method not found: "Serilog.LoggerConfiguration Serilog.SeqLoggerConfigurationExtensions.Seq (Serilog.Configuration.LoggerSinkConfiguration, System.String , Serilog.Events.LogEventLevel, Int32, System.Nullable 1<System.TimeSpan>, System.String, System.String, System.Nullable1, System.Nullable 1<Int64>, Serilog.Core.LoggingLevelSwitch, System.Net.Http.HttpMessageHandler, System.Nullable1, Boolean, Int32) '.
Unit Test Example - Serilog
[Fact]
public void TestMethod1()
{
LoggerConfiguration loggerConfig = new LoggerConfiguration();
loggerConfig.MinimumLevel.Debug();
loggerConfig.WriteTo.LiterateConsole();
loggerConfig.WriteTo.Seq("http://localhost:65454");
}
net462, , , VS 2017, .NET Framework. VS 2015. , DLL- / .. - ?
nuget, - ProjectReference .NET Core CSPROJ. , .
KeyVault, VS Test Runner ...
(x86): KeyVault
: System.MissingMethodException: : 'Void Microsoft.Azure.KeyVault.KeyVaultClient..ctor(AuthenticationCallback, System.Net.Http.DelegatingHandler [])'.
Unit Test - KeyVault
[Fact]
public void TestMethod1()
{
KeyVaultClient _kvClient = new KeyVaultClient(new AuthenticationCallback(getKeyVaultToken));
}
private static async Task<string> getKeyVaultToken(string authority, string resource, string scope)
{
var authContext = new AuthenticationContext(authority);
ClientCredential clientCred = new ClientCredential("test", "account");
AuthenticationResult result = authContext.AcquireTokenAsync(resource, clientCred).Result;
if (result == null)
throw new InvalidOperationException("Failed to obtain the JWT token");
return result.AccessToken;
}