コード例 #1
0
 public static void RunScript(string scriptPath)
 {
     using (DatabaseContext _DatabaseContext = new DatabaseContext())
     {
         _DatabaseContext.ExecuteStoreCommand(Filer.ReadFromFile(scriptPath));
     }
 }
コード例 #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Game Player
            IGameView      gameView       = new GameFormView();
            Game           gameModel      = new Game();
            GameController gameController = new GameController(gameModel, gameView);
            GameBoardForm  gameBoard      = new GameBoardForm(gameView, gameController);

            // File Handler
            IFiler  filer  = new Filer();
            ISaver  saver  = (ISaver)filer;
            ILoader loader = (ILoader)filer;

            FilerForm       filerView    = new FilerForm();
            IGameFiler      gameFiler    = new GameFiler();
            FilerController filerControl = new FilerController(saver, loader, filer, gameFiler, gameModel, filerView);

            // Level Designer
            ILevelDesignView designView  = new LevelDesignerForm();
            IChecker         designCheck = new Checker();
            ILevelDesigner   designModel = new LevelDesigner(designCheck);

            ILevelDesignController designController = new LevelDesignController(designView, designModel);


            BaseForm baseForm = new BaseForm(gameBoard, filerControl, designController);

            Application.Run(baseForm);
        }
コード例 #3
0
        public void TestGame37PushBlockTwoTimesThenUndoLastTwoMoves()
        {
            Filer filer = new Filer(Loader, Saver, Converter, Checker);
            Game  game  = new Game(filer);

            // block starts at row 4 column 3
            game.Load("#######\n#     #\n#    .#\n# $   #\n# @   #\n#######");
            Parts block1 = game.WhatsAt(4 - OFFSET, 3 - OFFSET);

            // act
            game.Move(Direction.Up); // block at 3 3
            Parts block2 = game.WhatsAt(3 - OFFSET, 3 - OFFSET);

            game.Move(Direction.Up); // block at 2 3
            Parts block3 = game.WhatsAt(2 - OFFSET, 3 - OFFSET);

            game.Undo();
            game.Undo();
            // block should be back at 4 3
            Parts actual4_3   = game.WhatsAt(4 - OFFSET, 3 - OFFSET);
            Parts expected4_3 = Parts.Block;

            //assert
            Assert.AreEqual(expected4_3, actual4_3,
                            "Block not returning to position two turns ago");
        }
コード例 #4
0
 /// <summary>
 /// Exports Passwords to the Supplied File
 /// </summary>
 /// <param name="Passwords">Passwords to be exported</param>
 /// <param name="FileName">File to which Passwords are to be exported.</param>
 /// <returns>Boolean: True if Passwords are exported otherwise False.</returns>
 public Task <bool> ExportPasswordsAsync(List <Password> Passwords, string FileName)
 {
     return(Task.Factory.StartNew(() =>
     {
         return Filer.ExportToFile(Passwords, FileName);
     }));
 }
コード例 #5
0
        public void TestGame32MovePlayerGreaterThan10TimesReturn11Count()
        {
            Filer filer = new Filer(Loader, Saver, Converter, Checker);
            Game  game  = new Game(filer);

            game.Load("#######\n#     #\n#    .#\n#    $#\n# @   #\n#######");
            int expected = 11;

            // act
            game.Move(Direction.Up);
            game.Move(Direction.Up);
            game.Move(Direction.Up);
            game.Move(Direction.Left);
            game.Move(Direction.Down);
            game.Move(Direction.Down);
            game.Move(Direction.Down);
            game.Move(Direction.Right);
            game.Move(Direction.Right);
            game.Move(Direction.Right);
            game.Move(Direction.Up);
            int actual = game.MoveCount;

            //assert
            Assert.AreEqual(expected, actual,
                            "Not returning zero count when no moves made");
        }
コード例 #6
0
        public async Task Loggout()
        {
            Filer.DeleteAllFiles();
            await Task.Delay(1);

            return;
        }
コード例 #7
0
 public static void ClassInit(TestContext context)
 {
     F                 = new Filer();
     Fl                = new Fileable(F);
     F.MyLevels        = new string[] { "--#####|###---#|#--*#-##|#-#--*-#|#-*--#-#|##-#+--#|-#---$##|-###--#|---####|", "--#####|###---#|#--*#-##|#-#--*-#|#-*--#-#|##-#+--#|-#---$##|-###--#|---####|" };
     F.MyCurLevelIndex = 0;
 }
コード例 #8
0
ファイル: Program.cs プロジェクト: WesleyNZ/CSharpSokoban
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //view
            //ILevelForm designer = new LevelDesignForm();
            ILevelDesignView designView = new LevelDesignForm();
            //IView view = new WinFormView(designer);

            //model
            IErrorHandler designCheck = new ErrorHandler();
            IMapEditor    designModel = new MapEditor(designCheck);

            //designController
            ILevelDesignController designController = new Controller(designView, designModel);


            //Sokoban_FileHandler
            IForm           form         = new FilerForm();
            ILoader         load         = new Filer();
            ISaver          save         = new Filer();
            FilerController filerControl = new FilerController(form, load, save);

            MainForm f = new MainForm(designController, filerControl);

            Application.Run(f);
        }
コード例 #9
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            /* << VIEWS >> */
            BaseForm  baseForm = new BaseForm();
            IGameView gameView = new GameFormView(); // injecting new << View >>
            //IGameView_Render gameView = new GameFormView_Render(); // injecting new << View >>
            //IGameView_Manual gameView = new GameFormView_Manual();
            IFilerView    filerView    = new FilerFormView();
            IDesignerView designerView = new DesignerFormView();

            /* << MODELS >> */
            IFiler    filer            = new Filer();
            IDesigner designer         = new Designer();
            IFileable designerFileable = (IFileable)designer;
            IGame     game             = new Game();
            IFileable gameFileable     = (IFileable)game;

            /* << CONTROLLER(S) >> */
            IGameController     gameController     = new GameController(gameView, filerView, filer, game, gameFileable);
            IDesignerController designerController = new DesignerController(filerView, designerView, filer, designer, designerFileable);

            baseForm.SetControllers(gameController, designerController);
            //gameView.SetController(gameController); // Set Controller for injected View
            Application.Run(baseForm);
        }
コード例 #10
0
        public Form1()
        {
            InitializeComponent();
            Bitmap img = new Bitmap(Application.StartupPath + @"\background.jpg");

            groupBoxForm.BackgroundImage       = img;
            groupBoxForm.BackgroundImageLayout = ImageLayout.Stretch;
            resources = new Filer();
        }
コード例 #11
0
 public static void ClassInit(TestContext context)
 {
     F          = new Filer();
     S          = F.GetMySaver();
     L          = F.GetMyLoader();
     F.MyLevels = new string[] { "--#####|###---#|#--*#-##|#-#--*-#|#-*--#-#|##-#+--#|-#---$##|-###--#|---####|", "--#####|###---#|#--*#-##|#-#--*-#|#-*--#-#|##-#+--#|-#---$##|-###--#|---####|" };
     S.Save("F:\\TestFiles\\LoaderTestInitFile.txt");
     F.MyLevels   = null;
     F.MyFilePath = "F:\\TestFiles";
 }
コード例 #12
0
        public void TestChk02CheckMoreThanOnePlayerPreExpanding()
        {
            string input    = "#.@+$@*";
            bool   expected = false;
            Filer  filer    = new Filer(Loader, Saver, Converter, Checker);
            // act
            bool actual = filer.PreExpandingCheck(input);

            // assert
            Assert.AreEqual(expected, actual, "Did not detect more than one player before expanding");
        }
コード例 #13
0
        public void TestChk08CheckGoalAndBlockPreCompression()
        {
            string input    = "#.# $ @";
            bool   expected = true;
            Filer  filer    = new Filer(Loader, Saver, Converter, Checker);
            // act
            bool actual = filer.PreCompressingCheck(input);

            // assert
            Assert.AreEqual(expected, actual, "Did not find equal number of blocks and goals before compressing");
        }
コード例 #14
0
        public void TestFile04TryToReadNonExistantFile()
        {
            string expected = "File does not exist";
            string fileName = "Testxxxx.txt";
            Filer  filer    = new Filer(Loader, Saver, Converter, Checker);
            // act
            string actual = filer.Load(AppDomain.CurrentDomain.BaseDirectory + @"\" + fileName);

            // assert
            Assert.AreEqual(expected, actual, "Did not detect that the file doesn't exist");
        }
コード例 #15
0
        public void TestChk06CheckNoPlayerPreCompressing()
        {
            string input    = "#.# $ ";
            bool   expected = false;
            Filer  filer    = new Filer(Loader, Saver, Converter, Checker);
            // act
            bool actual = filer.PreCompressingCheck(input);

            // assert
            Assert.AreEqual(expected, actual, "Did not detect more than one player before compressing");
        }
コード例 #16
0
        public void TestChk04CheckOnePlayerPreCompressing()
        {
            string input    = "#@.$ ###";
            bool   expected = true;
            Filer  filer    = new Filer(Loader, Saver, Converter, Checker);
            // act
            bool actual = filer.PreCompressingCheck(input);

            // assert
            Assert.AreEqual(expected, actual, "Did not detect only one player before compressing");
        }
コード例 #17
0
ファイル: Program.cs プロジェクト: WesleyNZ/CSharpSokoban
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            IView View = new WindowsFormView();
            IFiler Filer = new Filer();
            GameController gControl = new GameController(new GameNS.Game(), View);
            GameBoardForm gameBoard = new GameBoardForm( View, gControl);

           Application.Run(gameBoard);
        }
コード例 #18
0
        public MeChat()
        {
            Filer       = new Filer();
            MediaCenter = new MediaCenter();
            Connection  = new ChatConnection();

            this.Config       = new Config();
            FriendProfileHost = new FriendProfileHost(this);
            UserProfileHost   = new UserProfileHost(this, FriendProfileHost.FriendProfiles);
            TalkDataHost      = new TalkDataHost(this);
        }
コード例 #19
0
        public void TestFil04CompressBeforeWriteToAFile()
        {
            string input    = "###...@@@+++$$$   ***";
            string expected = "3#3.3@3+3$3-3*";
            string fileName = "Test02.txt";
            Filer  filer    = new Filer(Loader, Saver, Converter, Checker);
            // act
            string temp   = filer.Save(AppDomain.CurrentDomain.BaseDirectory + @"\" + fileName, input);
            string actual = filer.LoadDontExpand(AppDomain.CurrentDomain.BaseDirectory + @"\" + fileName);

            // assert
            Assert.AreEqual(expected, actual, "Did not compress the file before writing");
        }
コード例 #20
0
        public void TestChk20CheckGoalCountPreExpansion()
        {
            string input    = "#.# $ @";
            int    expected = 1;
            Filer  filer    = new Filer(Loader, Saver, Converter, Checker);

            // act
            filer.PreExpandingCheck(input);
            int actual = filer.NoGoals;

            // assert
            Assert.AreEqual(expected, actual, "Did not count one goal before Expansion");
        }
コード例 #21
0
        public void TestFile02SaveToExistingFileName()
        {
            string input    = "#.@ $##########";
            string fileName = "TestFile02.txt";
            string expected = "Overwrite existing file?";
            Filer  filer    = new Filer(Loader, Saver, Converter, Checker);
            // act
            string actual = filer.Save(AppDomain.CurrentDomain.BaseDirectory + @"\" + fileName, input);

            actual = filer.Save(AppDomain.CurrentDomain.BaseDirectory + @"\" + fileName, input);
            // assert
            Assert.AreEqual(expected, actual, "Did not detect existing file");
        }
コード例 #22
0
        public void TestChk17CheckGoalCountGreaterThan10PreExpansion()
        {
            string input    = "11#11.11@11+11$11-11*";;
            int    expected = 22;
            Filer  filer    = new Filer(Loader, Saver, Converter, Checker);

            // act
            filer.PreExpandingCheck(input);
            int actual = filer.NoGoals;

            // assert
            Assert.AreEqual(expected, actual, "Did not count 22 Goals before expansion");
        }
コード例 #23
0
        public void TestChk14CheckGoalCountPreExpansion()
        {
            string input    = "3#3.3@3+3$3-3*";
            int    expected = 6;
            Filer  filer    = new Filer(Loader, Saver, Converter, Checker);

            // act
            filer.PreExpandingCheck(input);
            int actual = filer.NoGoals;

            // assert
            Assert.AreEqual(expected, actual, "Did not count six Goals before expansion");
        }
コード例 #24
0
ファイル: DefaultWebTestPlugin.cs プロジェクト: EISK/archive
        public static void RunScript(string connectionString, string scriptPath)
        {
            SqlCommand sqlCmd = new SqlCommand();

            sqlCmd.CommandType = System.Data.CommandType.Text;
            sqlCmd.CommandText = Filer.ReadFromFile(scriptPath);
            using (SqlConnection cn = new SqlConnection(connectionString))
            {
                sqlCmd.Connection = cn;
                cn.Open();
                sqlCmd.ExecuteNonQuery();
            }
        }
コード例 #25
0
        public void TestChk09CheckPlayerCountPreCompression()
        {
            string input    = "#.# $ @";
            int    expected = 1;
            Filer  filer    = new Filer(Loader, Saver, Converter, Checker);

            // act
            filer.PreCompressingCheck(input);
            int actual = filer.NoPlayers;

            // assert
            Assert.AreEqual(expected, actual, "Did not count only one player before compression");
        }
コード例 #26
0
        public void TestFile01SaveStringToFile()
        {
            string input    = "#.@ $##########";
            string fileName = "TestFile02.txt";
            bool   expected = true;
            Filer  filer    = new Filer(Loader, Saver, Converter, Checker);
            // act
            string temp   = filer.Save(AppDomain.CurrentDomain.BaseDirectory + @"\" + fileName, input);
            bool   actual = File.Exists(fileName);

            // assert
            Assert.AreEqual(expected, actual, "Did not save to a file");
        }
コード例 #27
0
        public void TestLoad01IncorrectGameStringSent()
        {
            //player starts at row 3 column 2
            Filer filer    = new Filer(Loader, Saver, Converter, Checker);
            Game  game     = new Game(filer);
            bool  expected = false;
            // act
            bool actual = game.Load("#######\n#  #\n#@ #\n####");

            // assert
            Assert.AreEqual(actual, expected,
                            "The game accepted an invalid string");
        }
コード例 #28
0
        public void TestLoad06InvalidGameStringTooManyPlayers()
        {
            //player starts at row 3 column 2
            Filer filer    = new Filer(Loader, Saver, Converter, Checker);
            Game  game     = new Game(filer);
            bool  expected = false;
            // act
            bool actual = game.Load("#####\n# @.#\n#@ $#\n####");

            // assert
            Assert.AreEqual(actual, expected,
                            "The game did not accept a valid string");
        }
コード例 #29
0
        public void TestChk10CheckBoxCountPreCompression()
        {
            string input    = "#.# $ @";
            int    expected = 1;
            Filer  filer    = new Filer(Loader, Saver, Converter, Checker);

            // act
            filer.PreCompressingCheck(input);
            int actual = filer.NoBoxes;

            // assert
            Assert.AreEqual(expected, actual, "Did not count one box before compressions");
        }
コード例 #30
0
        public MultipleFilesHandle(string username, HttpFileCollectionBase fileCollection, bool isNoFolder = false)
        {
            var filer = Filer.SetUsername(username);

            if (isNoFolder)
            {
                filer.SetCurrentFolder("WipeOut");
            }

            FileKeys = filer.AddFiles(fileCollection)
                       .Upload()
                       .GetKeys();
        }