Ejemplo n.º 1
0
        public void It_should_return_the_db_driver()
        {
            // Arrange
            var dbDriverType             = typeof(GlimpseDbDriverDummy);
            var glimpseDbDriverActivator = new GlimpseDbDriverActivator();

            // Act
            var result = glimpseDbDriverActivator.CreateDbDriver(dbDriverType);

            // Assert
            Assert.NotNull(result);
            Assert.IsAssignableFrom <GlimpseDbDriverDummy>(result);
        }
Ejemplo n.º 2
0
        public void It_should_throw_an_invalid_cast_exception()
        {
            // Arrange
            var dbDriverType             = typeof(GlimpseDbDriverDummy);
            var glimpseDbDriverActivator = new GlimpseDbDriverActivator();

            try
            {
                // Act
                glimpseDbDriverActivator.CreateDbDriver(dbDriverType);
                Assert.False(true, "Expected exception as not thrown");
            }
            catch (InvalidCastException exception)
            {
                // Assert
                Assert.Equal(string.Format("Unable to cast object of type '{0}' to type '{1}'.", dbDriverType.Name, typeof(IGlimpseDbDriver).FullName), exception.Message);
            }
        }