Пример #1
0
        public void ResetInstanceCache_Should_RemoveAllSession()
        {
            // Arrange
            var db = new MockUnitTestDatabase(InitializeDatabase, ref _sessionName);

            // Act
            UnitTestDatabase.ResetInstanceCache();

            // Assert
            Assert.Equal(0, db.DefinedSessions);
        }
Пример #2
0
        public void InitializeDatabase_Should_NotErrorIfCalledSecondTime()
        {
            // Arrange
            var db = new MockUnitTestDatabase(InitializeDatabase, ref _sessionName);

            // Act & Assert
            db.InitializeDatabase(InitializeDatabase);

            // Assert
            Assert.NotNull(db);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
            }
        }