public void SqlServerDetector_detects_LocalDB_v11_0_on_dev_machine()
 {
     using (
         var detector = new powershell::System.Data.Entity.ConnectionFactoryConfig.SqlServerDetector(
             Registry.LocalMachine, new Mock<powershell::System.Data.Entity.ConnectionFactoryConfig.ServiceControllerProxy>().Object)
         )
     {
         Assert.Equal("11.0", detector.TryGetLocalDBVersionInstalled());
     }
 }
 public void SqlServerDetector_detects_SQL_Express_on_dev_machine()
 {
     using (
         var detector = new powershell::System.Data.Entity.ConnectionFactoryConfig.SqlServerDetector(
             new Mock<powershell::System.Data.Entity.ConnectionFactoryConfig.RegistryKeyProxy>().Object,
             new powershell::System.Data.Entity.ConnectionFactoryConfig.ServiceControllerProxy(
                 new ServiceController("MSSQL$SQLEXPRESS"))))
     {
         Assert.True(detector.IsSqlExpressInstalled());
     }
 }
        public void SqlServerDetector_generates_SQL_Express_base_connection_string_if_Express_is_installed_and_LocalDB_is_not()
        {
            var specification =
                new powershell::System.Data.Entity.ConnectionFactoryConfig.SqlServerDetector(
                    CreatedMockedRegistryKey(new string[0]), CreateMockedController())
                    .BuildConnectionFactorySpecification();

            Assert.Equal(
                powershell::System.Data.Entity.ConnectionFactoryConfig.ConnectionFactorySpecification.SqlConnectionFactoryName,
                specification.ConnectionFactoryName);
            Assert.Empty(specification.ConstructorArguments);
        }
        public void SqlServerDetector_generates_LocalDB_11_base_connection_string_if_neither_LocalDB_or_Express_are_installed()
        {
            var specification =
                new powershell::System.Data.Entity.ConnectionFactoryConfig.SqlServerDetector(
                    CreatedMockedRegistryKey(new string[0]), CreateMockedController(status: null))
                    .BuildConnectionFactorySpecification();

            Assert.Equal(
                powershell::System.Data.Entity.ConnectionFactoryConfig.ConnectionFactorySpecification.LocalDbConnectionFactoryName,
                specification.ConnectionFactoryName);
            Assert.Equal("v11.0", specification.ConstructorArguments.Single());
        }
        public void Base_connection_string_on_dev_box_with_SQL_Express_installed_has_SQL_Express_connection_string()
        {
            using (
                var detector = new powershell::System.Data.Entity.ConnectionFactoryConfig.SqlServerDetector(
                    Registry.LocalMachine,
                    new powershell::System.Data.Entity.ConnectionFactoryConfig.ServiceControllerProxy(
                        new ServiceController("MSSQL$SQLEXPRESS"))))
            {
                var specification = detector.BuildConnectionFactorySpecification();

                Assert.Equal(
                    powershell::System.Data.Entity.ConnectionFactoryConfig.ConnectionFactorySpecification.SqlConnectionFactoryName,
                    specification.ConnectionFactoryName);
                Assert.Empty(specification.ConstructorArguments);
            }
        }