public void ResetInstanceCache_Should_RemoveAllSession() { // Arrange var db = new MockUnitTestDatabase(InitializeDatabase, ref _sessionName); // Act UnitTestDatabase.ResetInstanceCache(); // Assert Assert.Equal(0, db.DefinedSessions); }
public void InitializeDatabase_Should_NotErrorIfCalledSecondTime() { // Arrange var db = new MockUnitTestDatabase(InitializeDatabase, ref _sessionName); // Act & Assert db.InitializeDatabase(InitializeDatabase); // Assert Assert.NotNull(db); }
public void RemoveInstance_Should_RemoveOnlySessionSpecified() { // Arrange var db1 = new MockUnitTestDatabase(InitializeDatabase, ref _sessionName); var session = _sessionName; var db2 = new MockUnitTestDatabase(InitializeDatabase, ref _sessionName); // Act UnitTestDatabase.RemoveInstance(session); // Assert Assert.Equal(1, db1.DefinedSessions); Assert.Equal(1, db2.DefinedSessions); }
public void RemoveInstance_Should_NotRemoveSessionThatDoesNotExist() { var obj = new Object(); lock (obj) { // Arrange var db = new MockUnitTestDatabase(InitializeDatabase, ref _sessionName); var sessions = db.DefinedSessions; // Act UnitTestDatabase.RemoveInstance("NONEXIST"); // Assert Assert.Equal(sessions, db.DefinedSessions); } }