Exemple #1
0
 // Update is called once per frame
 protected void Update()
 {
     if (InstructionsController.isMessageOnScreen())
     {
         GetComponent <RocketBase>().SetPlayerVelocity(0.0001f);
     }
 }
Exemple #2
0
        public async void CanGetOneInstruction()
        {
            DbContextOptions <CookBookDbContext> options = new DbContextOptionsBuilder <CookBookDbContext>().UseInMemoryDatabase("CanGetOneInstruction").Options;

            using (CookBookDbContext context = new CookBookDbContext(options))
            {
                //Arrange
                Instructions recipe = new Instructions();
                recipe.RecipeID     = 1;
                recipe.StepNumberID = 2;
                recipe.Action       = "Boil water";
                Instructions recipe2 = new Instructions();
                recipe.RecipeID     = 2;
                recipe.StepNumberID = 1;
                recipe.Action       = "Mash taters";
                Instructions recipe3 = new Instructions();
                recipe.RecipeID     = 3;
                recipe.StepNumberID = 1;
                recipe.Action       = "Beat eggs";

                //Act
                InstructionsController InstructionsController = new InstructionsController(context, configuration);
                await InstructionsController.Post(recipe);

                await InstructionsController.Post(recipe2);

                await InstructionsController.Post(recipe3);

                var result = InstructionsController.Get(3, 1);

                //Assert
                Assert.IsType <OkObjectResult>(result);
            }
        }
Exemple #3
0
        public async void CannotDeleteInstruction()
        {
            DbContextOptions <CookBookDbContext> options = new DbContextOptionsBuilder <CookBookDbContext>().UseInMemoryDatabase("CannotDeleteInstruction").Options;

            using (CookBookDbContext context = new CookBookDbContext(options))
            {
                //Arrange
                Instructions recipe = new Instructions();
                recipe.RecipeID     = 1;
                recipe.StepNumberID = 2;
                recipe.Action       = "Boil water";
                Instructions recipe2 = new Instructions();
                recipe2.RecipeID     = 3;
                recipe2.StepNumberID = 4;
                recipe2.Action       = "Mash taters";

                //Act
                InstructionsController instructionsController = new InstructionsController(context, configuration);
                await instructionsController.Post(recipe);

                await instructionsController.Post(recipe2);

                var result = await instructionsController.Delete(5, 5);

                //Assert
                Assert.IsType <NotFoundResult>(result);
            }
        }
Exemple #4
0
        public async void EditMakesNewInstructions()
        {
            DbContextOptions <CookBookDbContext> options = new DbContextOptionsBuilder <CookBookDbContext>().UseInMemoryDatabase("EditMakesNewInstructions").Options;

            using (CookBookDbContext context = new CookBookDbContext(options))
            {
                //Arrange
                Instructions recipe = new Instructions();
                recipe.RecipeID     = 1;
                recipe.StepNumberID = 2;
                recipe.Action       = "Boil water";
                Instructions recipe2 = new Instructions();
                recipe2.RecipeID     = 3;
                recipe2.StepNumberID = 4;
                recipe2.Action       = "Mash taters";
                Instructions edit = new Instructions();
                edit.RecipeID     = 5;
                edit.StepNumberID = 1;
                edit.Action       = "Beat eggs";

                //Act
                InstructionsController instructionsController = new InstructionsController(context, configuration);
                await instructionsController.Post(recipe);

                await instructionsController.Post(recipe2);

                var data = await instructionsController.Put(5, 1, edit);

                //Assert
                Assert.IsType <RedirectToActionResult>(data);
            }
        }
 public void TestInitialize()
 {
     _mockRepository = new Mock <IQualityControlRepository>();
     _mockFactory    = new Mock <QualityControlFactory>();
     _mockUnitOfWork.SetupGet(uw => uw.QualityControlRepository).Returns(_mockRepository.Object);
     _controller           = new InstructionsController(_mockUnitOfWork.Object, _mockFactory.Object);
     _controller.GetUserId = () => GetGuid("1571");
     _mockRepository.Setup(r => r.FindByIdAsync(It.IsAny <int>())).Returns(Task.FromResult(control));
 }
Exemple #6
0
        public void ReadMe()
        {
            // Arrange
            InstructionsController controller = new InstructionsController();

            // Act
            ViewResult result = controller.ReadMe() as ViewResult;

            // Assert
            Assert.IsNotNull(result);
        }
Exemple #7
0
        public void Contact_ViewBag_Message()
        {
            // Arrange
            InstructionsController controller = new InstructionsController();

            // Act
            ViewResult result = controller.Contact() as ViewResult;

            // Assert
            Assert.IsNotNull("Contact Details", result.ViewBag.Message);
        }
Exemple #8
0
        public void Contact_ViewName()
        {
            // Arrange
            InstructionsController controller = new InstructionsController();

            // Act
            ViewResult result = controller.Contact() as ViewResult;

            // Assert
            Assert.IsNotNull("Contact", result.ViewName);
        }
Exemple #9
0
        public void ReadMe_ViewName()
        {
            // Arrange
            InstructionsController controller = new InstructionsController();

            // Act
            ViewResult result = controller.ReadMe() as ViewResult;

            // Assert
            Assert.AreEqual("ReadMe", result.ViewName);
        }
Exemple #10
0
    // Use this for initialization
    void Start()
    {
        Rocket current    = GameObject.Find("RocketDatabase").GetComponent <RocketsDatabase>().GetCurrentRocket();
        Map    currentMap = GameObject.Find("MapDatabase").GetComponent <MapsDatabase>().GetCurrentMap();

        SetRocket(current);
        SetMap(currentMap);

        if (PlayerPrefsX.GetBool("ShowArrows") || InstructionsController.isMessageOnScreen())
        {
            GameObject.Find("BotBody").GetComponent <SpriteRenderer>().enabled      = false;
            GameObject.Find("BotHead").GetComponent <SpriteRenderer>().enabled      = false;
            GameObject.Find("TopBody").GetComponent <SpriteRenderer>().enabled      = false;
            GameObject.Find("TopHead").GetComponent <SpriteRenderer>().enabled      = false;
            GameObject.Find("TopSpeedBody").GetComponent <SpriteRenderer>().enabled = false;
            GameObject.Find("TopSpeedHead").GetComponent <SpriteRenderer>().enabled = false;
        }
    }
    /// <summary>
    /// Handles the user SwinGame.
    /// </summary>
    /// <remarks>
    /// Reads key and mouse input and converts these into
    /// actions for the game to perform. The actions
    /// performed depend upon the state of the game.
    /// </remarks>
    public static void HandleUserInput()
    {
        //Read incoming input events
        SwinGame.ProcessEvents();

        if (CurrentState == GameState.ViewingMainMenu)
        {
            MenuController.HandleMainMenuInput();
        }
        else if (CurrentState == GameState.ViewingGameMenu)
        {
            MenuController.HandleGameMenuInput();
        }
        else if (CurrentState == GameState.AlteringSettings)
        {
            MenuController.HandleSetupMenuInput();
        }
        else if (CurrentState == GameState.AlterMusics)
        {
            MenuController.HandleMusicMenuInput();
        }
        else if (CurrentState == GameState.Deploying)
        {
            DeploymentController.HandleDeploymentInput();
        }
        else if (CurrentState == GameState.Discovering)
        {
            DiscoveryController.HandleDiscoveryInput();
        }
        else if (CurrentState == GameState.EndingGame)
        {
            EndingGameController.HandleEndOfGameInput();
        }
        else if (CurrentState == GameState.ViewingHighScores)
        {
            HighScoreController.HandleHighScoreInput();
        }
        else if (CurrentState == GameState.ViewingInstructions)
        {
            InstructionsController.HandleInstructionsInput();
        }

        UtilityFunctions.UpdateAnimations();
    }
Exemple #12
0
 public void OnPointerDown(PointerEventData data)
 {
     if (gameObject.name == "Instrucciones")
     {
         if (botonControles.activeInHierarchy)
         {
             audioController.speak(gameObject.transform.GetComponentInChildren <Text>().text);
             panelInstrucciones.SetActive(true);
             botonControles.SetActive(false);
             botonInstrucciones.GetComponentInChildren <Text>().text = "Cerrar";
             imageInstruction.sprite = Resources.Load <Sprite>("close");
             instructionsController  = GameObject.Find("ControladorInstrucciones").GetComponent <InstructionsController>();
             instructionsController.reproducirInstrucciones();
         }
         else
         {
             audioController.stopSpeak();
             panelInstrucciones.SetActive(false);
             botonControles.SetActive(true);
             botonInstrucciones.GetComponentInChildren <Text>().text = "Instrucciones";
             imageInstruction.sprite = Resources.Load <Sprite>("info");
             audioController.speak(GameObject.FindGameObjectWithTag("TituloPantallaJuego").GetComponent <Text>().text);
         }
     }
     else if (gameObject.name == "Controles")
     {
         if (botonInstrucciones.activeInHierarchy)
         {
             audioController.speak(gameObject.transform.GetComponentInChildren <Text>().text);
             panelControles.SetActive(true);
             botonInstrucciones.SetActive(false);
             botonControles.GetComponentInChildren <Text>().text = "Cerrar";
             imageControl.sprite = Resources.Load <Sprite>("close");
         }
         else
         {
             audioController.speak(GameObject.FindGameObjectWithTag("TituloPantallaJuego").GetComponent <Text>().text);
             panelControles.SetActive(false);
             botonInstrucciones.SetActive(true);
             botonControles.GetComponentInChildren <Text>().text = "Controles";
             imageControl.sprite = Resources.Load <Sprite>("settings");
         }
     }
 }
    private void ShowHeightText()
    {
        string heightText;
        float  height;

        height     = GameObject.FindWithTag("Player").GetComponent <Transform>().position.y;
        heightText = ((height + 2.872187f) * 5).ToString("####0.0");
        if (!InstructionsController.isMessageOnScreen())
        {
            GameObject.Find("TextHeight").GetComponent <Text>().text = "" + heightText + "\n" + "m";
        }
        else
        {
            GameObject.Find("TextHeight").GetComponent <Text>().text = "";
        }

        if (Time.timeScale <= 0.98f)
        {
            GameObject.Find("TextHeight").GetComponent <Text>().text = "";
        }
    }
    private void ShowVelocityText()
    {
        string velocityText;
        float  velocity;

        velocity     = Mathf.Abs(GameObject.FindWithTag("Player").GetComponent <Rigidbody2D>().velocity.y);
        velocityText = (velocity * 10).ToString("####0.0");
        if (!InstructionsController.isMessageOnScreen())
        {
            GameObject.Find("TextVelocity").GetComponent <Text>().text = "" + velocityText + "\n" + "km/h";
        }
        else
        {
            GameObject.Find("TextVelocity").GetComponent <Text>().text = "";
        }

        if (Time.timeScale <= 0.98f)
        {
            GameObject.Find("TextVelocity").GetComponent <Text>().text = "";
        }
    }
Exemple #15
0
        public async void CanCreateInstructions()
        {
            DbContextOptions <CookBookDbContext> options = new DbContextOptionsBuilder <CookBookDbContext>().UseInMemoryDatabase("CanCreateInstructions").Options;

            using (CookBookDbContext context = new CookBookDbContext(options))
            {
                //Arrange
                Instructions recipe = new Instructions();
                recipe.RecipeID     = 1;
                recipe.StepNumberID = 2;
                recipe.Action       = "Boil water";

                //Act
                InstructionsController InstructionsController = new InstructionsController(context, configuration);
                await InstructionsController.Post(recipe);

                var result = await context.Instructions.FirstOrDefaultAsync(c => c.RecipeID == recipe.RecipeID);

                //Assert
                Assert.Equal(recipe, result);
            }
        }
	// Use this for initialization


	void Start () {
	Instructionsreference = this;
		instructionsbool = true;
		DontDestroyOnLoad (this);
		Destroy (this,21);
	}
 void Awake()
 {
     instance = this;
 }
Exemple #18
0
 public InstructionsControllerTests()
 {
     repo      = Substitute.For <IInstructionsRepository>();
     underTest = new InstructionsController(repo);
 }