public void can_extract_file()
        {
            using (var tempdir = new TempDirectoryPathAbsolute())
            {
                var task = new ExtractZipFileTask {
                    SourceZip = "Resources/TestFile.zip",
                    DestinationDir = tempdir.Path
                };
                task.PrepareAndAssertNoErrors ();
                task.ExecuteAndAssertNoErrors ();

                var expected = Path.Combine(tempdir.Path, "TestFile.txt");
                Assert.True(File.Exists(expected));
            }
        }
        public void can_execute_script()
        {
            var task = GetTaskWithCredentials();
            using (var tempdir = new TempDirectoryPathAbsolute())
            {
                // write the script file to drive
                var file = tempdir.SaveToTempFile(string.Format (@"
                    create table {0} ( my_id int );
                    go
                    insert into {0} values ( 2 );
                    go", _table));

                task.ScriptFiles = new[] { file };

                task.PrepareAndAssertNoErrors();
                task.ExecuteAndAssertNoErrors();
            }
            AssertQueryReturns("select my_id from " + _table, 2);
        }
        public void can_execute_multiple_scripts()
        {
            var task = GetTaskWithCredentials ();
            using (var tempdir = new TempDirectoryPathAbsolute ())
            {
                var file1 = tempdir.SaveToTempFile (string.Format (@"
                    create table {0} ( my_id int );
                    go
                    insert into {0} values ( 1 );
                    go", _table));

                var file2 = tempdir.SaveToTempFile(string.Format(@"
                    insert into {0} values ( 2 )", _table));

                task.ScriptFiles = new[] { file1, file2 };

                task.PrepareAndAssertNoErrors ();
                task.ExecuteAndAssertNoErrors ();
            }

            using (var connection = GetOpenConnection ())
            {
                using (var command = connection.CreateCommand ())
                {
                    command.CommandType = CommandType.Text;
                    command.CommandText = "select my_id from " + _table + " where my_id = 1";
                    Assert.AreEqual (1, command.ExecuteScalar ());
                }
                using (var command = connection.CreateCommand ())
                {
                    command.CommandType = CommandType.Text;
                    command.CommandText = "select my_id from " + _table + " where my_id = 2";
                    Assert.AreEqual (2, command.ExecuteScalar ());
                }
            }
        }
        public void B_test_that_does_cleanup_temp_dir_but_fails_because_last_test()
        {
            var tempDir = new TempDirectoryPathAbsolute();

            Assert.Throws<AssertionException> (tempDir.Dispose);
        }
 public void A_test_that_doesnt_clean_up_temp_dir()
 {
     var tempDir = new TempDirectoryPathAbsolute();
 }