public static void ClassCleanup() { using (var serviceScope = _factory.Server.Services.CreateScope()) { var sqlExecuter = serviceScope.ServiceProvider.GetService <IRhetosComponent <ISqlExecuter> >().Value; sqlExecuter.ExecuteSql($@" DELETE pp FROM Common.PrincipalPermission pp INNER JOIN Common.Principal p ON pp.PrincipalID = p.ID WHERE p.Name like '{RandomNamePrefix}%'; DELETE m FROM dbo.webpages_Membership m INNER JOIN Common.Principal p ON p.AspNetUserId = m.UserId WHERE p.Name like '{RandomNamePrefix}%'; DELETE p FROM Common.Principal p WHERE p.Name like '{RandomNamePrefix}%';"); serviceScope.ServiceProvider.GetService <IRhetosComponent <IUnitOfWork> >().Value.CommitAndClose(); } _factory.Dispose(); }
/// <summary> /// This method must be implemented to satisfy the compiler because it's the only way to safely ensure that /// any future child classes will can have the ability to properly clean up their parent classes via Dispose(). /// </summary> protected void Dispose(bool disposing) { // Ensure we don't get disposed of multiple times, which could cause memory leaks or null pointer exceptions. if (_isDisposed) { return; } // Only call Dispose() on other managed objects if we're told to. if (disposing) { // free managed resources _factory.Dispose(); } // This location in the code is where you should always clean up any unmanaged resources, regardless of the state of // the `disposing` parameter. // If your code does hold references to unmanaged resources, you MUST also implement the finalizer yourself as follows: // // public ~TestClientManager() // { // Dispose(false); // } // // This ensures that you will always clean up unmanaged resources when being destroyed by the garbage collector, // preventing memory leaks. If your class does NOT directly handle unmanaged resources, do not implement the finalizer. _isDisposed = true; }
public void Dispose() { factory?.Dispose(); var client = new MongoClient(settings.ConnectionString); client.DropDatabase(settings.Database); }
public void Dispose() { ServiceProvider.GetService <ILogger <TestApplicationHost> >() ?.LogInformation($"Disposing test host ({_testMethodName})."); _sqliteConnection?.Dispose(); _applicationFactory?.Dispose(); }
public override void Dispose() { _agent?.Dispose(); _factory?.Dispose(); _client?.Dispose(); base.Dispose(); }
protected virtual void Dispose(bool disposing) { if (disposing) { Client?.Dispose(); Factory?.Dispose(); } }
public static void Cleanup() { ClientFactory?.Dispose(); AdminClient?.Dispose(); UserClient?.Dispose(); ClientFactory = null; AdminClient = null; UserClient = null; }
public void Dispose() { if (!_disposed) { _client?.Dispose(); _factory?.Dispose(); _disposed = true; } }
protected virtual void Dispose(bool disposing) { if (disposing) { MailServiceMock.MailsSent.Clear(); Client?.Dispose(); Factory?.Dispose(); } }
public void TearDown() { BearerToken = null; if (TestFactory != null) { TestFactory.Dispose(); TestFactory = null; } }
public void TearDown() { if (_storageClient != null) { _storageClient.Dispose(); } if (_apiFactory != null) { _apiFactory.Dispose(); } }
public void Shutdown() { _easyServices?.Dispose(); _blankFactory?.Dispose(); _carterFactory?.Dispose(); _easyRoutingServices?.Dispose(); _easyClient?.Dispose(); _blankClient?.Dispose(); _carterClient?.Dispose(); _easyRoutingClient?.Dispose(); }
protected virtual void Dispose(bool aIsDisposing) { if (!DisposedValue) { if (aIsDisposing) { ServerWebApplicationFactory.Dispose(); } DisposedValue = true; } }
private void Dispose(bool aIsDisposing) { if (!Disposed) { if (aIsDisposing) { WebApplicationFactory?.Dispose(); ServiceScopeFactory?.Dispose(); } Disposed = true; } }
private bool _disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { _webAppFactory.Dispose(); } _disposedValue = true; } }
public void Dispose() { try { TestDataUtilities.CleanupBlobFile(_factory, _documentVersionId, _fileContentId); } finally { _factory.Dispose(); } GC.SuppressFinalize(this); }
private void Dispose(bool aIsDisposing) { if (!Disposed) { if (aIsDisposing) { Console.WriteLine("==== Disposing ===="); WebApplicationFactory?.Dispose(); ServiceScopeFactory?.Dispose(); } Disposed = true; } }
protected virtual void Dispose(bool aIsDisposing) { if (!DisposedValue) { if (aIsDisposing) { Console.WriteLine("==== Disposing ===="); ServerWebApplicationFactory?.Dispose(); } DisposedValue = true; } }
public void Dispose() { var testConfig = new ConfigurationBuilder() .AddUserSecrets <TestFixture>().Build(); var contextOptions = new DbContextOptionsBuilder <TodoContext>() .UseCosmos(testConfig["AzureCosmosDB:ReadWriteKey"], databaseName: "Todos").Options; var context = new TodoContext(contextOptions); context.TodoItems.RemoveRange(context.TodoItems); context.SaveChanges(); _factory.Dispose(); }
// The bulk of the clean-up code is implemented in Dispose(bool) protected virtual void Dispose(bool disposing) { if (_factory != null) { _factory.Dispose(); _factory = null; } if (_dbRunner != null) { _dbRunner.Dispose(); _dbRunner = null; } }
public void Stop() { if (Client != null) { Client.Dispose(); Client = null; } if (_factory != null) { _factory.Dispose(); _factory = null; } UTHelpers.Down(_newFilePath); }
public async Task Get_EndpointsReturnSuccessAndCorrectContentType(string url) { // Arrange AuthenticationManager authenticationManager = new AuthenticationManager(); authenticationManager.client = _factory.CreateClient(); File.WriteAllBytes("rsaCert.pfx", Startup.RsaCertPfxBytes); Chilkat.Pfx pfx = new Chilkat.Pfx(); if (File.Exists("rsaCert.pfx")) { pfx.LoadPfxFile("rsaCert.pfx", "12345"); } File.Delete("rsaCert.pfx"); // Act //public key from certificate //Chilkat package is used to process X509 certificate 2 from pfx file to JWKS (Json Web Key Set) from which it is possible //to extract public key X5c. Key is then compared with the one pulled from mocked server. string alias = "my_ecc_key1"; string password = "******"; Chilkat.JavaKeyStore jks = pfx.ToJavaKeyStore(alias, password); Chilkat.StringBuilder sbJwkSet = new Chilkat.StringBuilder(); jks.ToJwkSet(password, sbJwkSet); Chilkat.JsonObject jwkSet = new Chilkat.JsonObject(); jwkSet.LoadSb(sbJwkSet); jwkSet.EmitCompact = false; var jwksCheck = jwkSet.Emit(); JsonWebKeySet jwkscheck = new JsonWebKeySet(jwksCheck); List <JsonWebKey> keyList2 = new List <JsonWebKey>(jwkscheck.Keys); string publicKey2 = keyList2[0].X5c[0]; //response from server System.Net.Http.HttpResponseMessage response = await authenticationManager.client.GetAsync(url); //public key from endpoint string publicKey = authenticationManager.GetPublicKey(url); // Assert response.EnsureSuccessStatusCode(); // Status Code 200-299 Assert.Equal(publicKey2, publicKey); authenticationManager.client.Dispose(); _factory.Dispose(); }
public void Dispose() { _factory?.Dispose(); _agent?.Dispose(); _client?.Dispose(); }
public void Teardown() { _factory.Dispose(); }
public void OneTimeTearDown() { RunAndSwallowException(() => DriverManager.Stop()); RunAndSwallowException(() => frontendServer?.Dispose()); RunAndSwallowException(() => webAppFactory?.Dispose()); }
public void Dispose() { Client?.Dispose(); factory?.Dispose(); }
public void Dispose() { _factory?.Dispose(); Client?.Dispose(); }
public void Dispose() { WebApplicationFactory?.Dispose(); GC.SuppressFinalize(this); }
public void Dispose() { factory.Dispose(); }
public static void ClassCleanup() { _factory.Dispose(); }