예제 #1
0
        public void Caesar_CipherTest()
        {
            Cipher cipher = new Caesar_Cipher("Hello World", "13");

            Assert.IsNotNull(cipher);
            cipher = null;
            Assert.IsNull(cipher);
        }
예제 #2
0
        public void EncryptTest()
        {
            // Testing Caesar Cipher
            string actual   = "Uryyb Jbeyq";
            Cipher cipher   = new Caesar_Cipher("Hello World", "13");
            string expected = cipher.Encrypt();

            Assert.AreEqual(expected, actual);
        }
예제 #3
0
        public void DecryptTest()
        {
            // Testing Caesar Cipher
            string expected = "Hello World";
            Cipher cipher   = new Caesar_Cipher("Uryyb Jbeyq", "13");
            string result   = cipher.Decrypt();

            Assert.AreEqual(expected, result);
        }
예제 #4
0
        public Menu2State(Game1 game, GraphicsDevice graphicsDevice, ContentManager content)
            : base(game, graphicsDevice, content)
        {
            //se si vuole fare qui la load bisogna mettere _content.Load invece di Content.Load
            ConstVar.isMouseVisibleM = true;
            var corniceCharacterTexture = _content.Load <Texture2D>("CornicePersonaggio");
            var buttonTexture           = _content.Load <Texture2D>("Controls/Button");
            var buttonFont = _content.Load <SpriteFont>("Fonts/Font");

            if (ConstVar.listaTexture.Count == 0)
            {
                ConstVar.listaTexture.Add(_content.Load <Texture2D>("Man"));
                ConstVar.listaTexture.Add(_content.Load <Texture2D>("Man2"));
                ConstVar.listaTexture.Add(_content.Load <Texture2D>("Man3"));
                ConstVar.listaTexture.Add(_content.Load <Texture2D>("Woman"));
                ConstVar.listaTexture.Add(_content.Load <Texture2D>("Woman2"));
                ConstVar.listaTexture.Add(_content.Load <Texture2D>("Woman3"));
            }
            ConstVar.standingMan1 = new StandingRotateSpritebatch(ConstVar.walkingCols, ConstVar.walkingFrame, ConstVar.timerWalking);//passo texture e infine timer

            /*altri possibili personaggi ma con signature pre-modifiche
             * ConstVar.standingMan2 = new StandingRotateSpritebatch(ConstVar.characterText, new Rectangle((int)ConstVar.positionCharacter.X, (int)ConstVar.positionCharacter.Y,
             *                    (int)ConstVar.dimCharacter.X, (int)ConstVar.dimCharacter.Y),
             *                    ConstVar.walkingCols, ConstVar.walkingFrame, ConstVar.timerWalking);//passo texture e infine timer
             * ConstVar.standingMan3 = new StandingRotateSpritebatch(ConstVar.characterText, new Rectangle((int)ConstVar.positionCharacter.X, (int)ConstVar.positionCharacter.Y,
             *                   (int)ConstVar.dimCharacter.X, (int)ConstVar.dimCharacter.Y),
             *                   ConstVar.walkingCols, ConstVar.walkingFrame, ConstVar.timerWalking);//passo texture e infine timer
             * ConstVar.standingWoman1 = new StandingRotateSpritebatch(ConstVar.characterText, new Rectangle((int)ConstVar.positionCharacter.X, (int)ConstVar.positionCharacter.Y,
             *                   (int)ConstVar.dimCharacter.X, (int)ConstVar.dimCharacter.Y),
             *                   ConstVar.walkingCols, ConstVar.walkingFrame, ConstVar.timerWalking);//passo texture e infine timer
             * ConstVar.standingWoman2 = new StandingRotateSpritebatch(ConstVar.characterText, new Rectangle((int)ConstVar.positionCharacter.X, (int)ConstVar.positionCharacter.Y,
             *                   (int)ConstVar.dimCharacter.X, (int)ConstVar.dimCharacter.Y),
             *                   ConstVar.walkingCols, ConstVar.walkingFrame, ConstVar.timerWalking);//passo texture e infine timer
             * ConstVar.standingWoman3 = new StandingRotateSpritebatch(ConstVar.characterText, new Rectangle((int)ConstVar.positionCharacter.X, (int)ConstVar.positionCharacter.Y,
             *                   (int)ConstVar.dimCharacter.X, (int)ConstVar.dimCharacter.Y),
             *                   ConstVar.walkingCols, ConstVar.walkingFrame, ConstVar.timerWalking);//passo texture e infine timer
             */

            var chooseCharacterButton = new Button(buttonTexture, buttonFont)//non è proprio un bottone è una scritta da migliorare
            {
                Position = new Vector2(ConstVar.displayDim.X / 2 - ConstVar.dimButtons.X / 2, 100),
                Text     = "Choose your character",
            };//è un finto bottone in realtà

            _componentNotClickable = chooseCharacterButton;
            //ora 6 possibilità di scelta
            //1
            var male1Button = new Button(corniceCharacterTexture, buttonFont)
            {
                Position = new Vector2(25, 350),
                //Text = "New Game",
            };

            male1Button.Click += Male1Button_Click;
            //2
            var male2Button = new Button(corniceCharacterTexture, buttonFont)
            {
                Position = new Vector2(230, 350),
                // Text = "New Game",
            };

            male2Button.Click += Male2Button_Click;
            //3
            var male3Button = new Button(corniceCharacterTexture, buttonFont)
            {
                Position = new Vector2(435, 350),
                // Text = "New Game",
            };

            male3Button.Click += Male3Button_Click;
            //4
            var female1Button = new Button(corniceCharacterTexture, buttonFont)
            {
                Position = new Vector2(640, 350),
                //Text = "New Game",
            };

            female1Button.Click += Female1Button_Click;
            //5
            var female2Button = new Button(corniceCharacterTexture, buttonFont)
            {
                Position = new Vector2(845, 350),
                // Text = "New Game",
            };

            female2Button.Click += Female2Button_Click;
            //6
            var female3Button = new Button(corniceCharacterTexture, buttonFont)
            {
                Position = new Vector2(1050, 350),
                // Text = "New Game",
            };

            female3Button.Click += Female3Button_Click;


            _components = new List <Component>()
            {
                male1Button,
                male2Button,
                male3Button,
                female1Button,
                female2Button,
                female3Button,
            };
            MainHouseState = new HouseMainCharacterState(_game, _graphicsDevice, _content);
            House2State    = new HouseState(_game, _graphicsDevice, _content);
            CaesarCypherS  = new CaesarCypherState(_game, _graphicsDevice, _content);
            Caesar         = new Caesar_Cipher(_content);
            VigenereS      = new VigenereState(_game, _graphicsDevice, _content);
            Vigenere       = new VigenereCypher(_content);
        }
예제 #5
0
        public void Is_Key_ValidTest()
        {
            Cipher cipher = new Caesar_Cipher("Hello World", "dog");

            Assert.IsFalse(cipher.Is_Key_Valid());
        }