예제 #1
0
        public async Task TestGetRecipeById()
        {
            // Arrange
            Recipe recipe1 = new Recipe
            {
                Author      = "user1",
                Title       = "newtitle",
                Type        = "type1",
                body        = "body1",
                Ingredients = "Ing1"
            };

            _recipes_context.Add(recipe1);
            _recipes_context.SaveChanges();


            // Act
            var result = await _recipeController.GetRecipe(1);

            var Ok_result       = result as OkObjectResult;
            var Ok_result_value = Ok_result.Value as Recipe;


            // Assert
            Assert.AreEqual("newtitle", Ok_result_value.Title);
            Assert.IsNotNull(Ok_result);
            Assert.IsInstanceOfType(result, typeof(OkObjectResult));
        }
예제 #2
0
    public void DefiningOFSlotsGOs()
    {
        GameObject Output = RecipeController.GetRecipe();

        GameObject[] inputs = new GameObject[1];
        float []     counts = new float[5];
        if (Output != null)
        {
            if (Output.GetComponent <MealMaterial>() != null)
            {
                inputs = Output.GetComponent <MealMaterial>().Inputs;
                counts = Output.GetComponent <MealMaterial>().InputCount;
            }
            else if (Output.GetComponent <Meal>() != null)
            {
                inputs = Output.GetComponent <Meal>().Inputs;
                counts = Output.GetComponent <Meal>().InputCount;
            }
            for (int i = 0; i < inputs.Length; i++)
            {
                slots[i].typeOfItem = inputs[i];
                slots[i].unitCount  = counts[i];
            }
            for (int i = inputs.Length; i < slots.Length; i++)
            {
                slots[i].typeOfItem = null;
            }
        }
    }
예제 #3
0
        private void BtnSaveAppointment_Click(object sender, EventArgs e)
        {
            Recipe recipe = new Recipe()
            {
                RecipeNumber = RecipeNumber
            };

            recipe = recipeController.GetRecipe(recipe);


            int sessionId   = examinationController.GetSessionId(SessionTimeId, doctor.DoctorId, DateTime.Today);
            int patientId   = patient.PatientId;
            int diognosisId = Convert.ToInt32(cmbDiagnosis.SelectedValue);
            int recipeId    = recipe.RecipeId;
            int exaStatu    = cmbExaminationStatus.SelectedIndex;

            if (cmbExaminationStatus.SelectedIndex != 0)
            {
                if (RecipeNumber == string.Empty)
                {
                    MessageBox.Show("Lütfen reçete yazınız.");
                }
                else
                {
                    if (examinationController.AddExamination(sessionId, patientId, diognosisId, recipeId, exaStatu))
                    {
                        MessageBox.Show("Muayene işlemi tamamlanmıştır.");
                        pnlPatientStatus.Visible = false;
                        CreateSession(DateTime.Today);
                    }
                    else
                    {
                        MessageBox.Show("Muayene eklerken sorun oluştu.");
                    }
                }
            }
            else
            {
                if (examinationController.AddExaminationAddExaminationForExaStatuZero(sessionId, patientId, diognosisId, exaStatu))
                {
                    MessageBox.Show("Muayene işlemi tamamlanmıştır.");
                    pnlPatientStatus.Visible = false;
                    CreateSession(DateTime.Today);
                }
                else
                {
                    MessageBox.Show("Muayene eklerken sorun oluştu.");
                }
            }
        }
예제 #4
0
        public async Task RecipeController_GetRecipe_EmptyId(string recipeId)
        {
            var directoryManager              = new DirectoryManager();
            var fileManager                   = new FileManager();
            var deploymentManifestEngine      = new DeploymentManifestEngine(directoryManager, fileManager);
            var consoleInteractiveServiceImpl = new ConsoleInteractiveServiceImpl();
            var consoleOrchestratorLogger     = new ConsoleOrchestratorLogger(consoleInteractiveServiceImpl);
            var commandLineWrapper            = new CommandLineWrapper(consoleOrchestratorLogger);
            var customRecipeLocator           = new CustomRecipeLocator(deploymentManifestEngine, consoleOrchestratorLogger, commandLineWrapper, directoryManager);
            var projectDefinitionParser       = new ProjectDefinitionParser(fileManager, directoryManager);

            var recipeController = new RecipeController(customRecipeLocator, projectDefinitionParser);
            var response         = await recipeController.GetRecipe(recipeId);

            Assert.IsType <BadRequestObjectResult>(response);
        }
예제 #5
0
        private void btnRecipeNumberQuery_Click(object sender, EventArgs e)
        {
            Recipe recipe = new Recipe
            {
                RecipeNumber = txtRecipeNumber.Text
            };

            if (recipeController.IsExistsRepice(recipe))
            {
                recipe = recipeController.GetRecipe(recipe);
                FormPharmacistRecipeDetails formPharmacistRecipeDetails = new FormPharmacistRecipeDetails(recipe);
                formPharmacistRecipeDetails.ShowDialog();
            }
            else
            {
                MessageBox.Show("Hatalı reçeti numarası girişi!");
            }
        }
예제 #6
0
        private void btnMedicineAdd_Click(object sender, EventArgs e)
        {
            Recipe recipe = new Recipe()
            {
                RecipeNumber = recipeNoSub
            };

            recipe = recipeController.GetRecipe(recipe);
            int medicineId = Convert.ToInt32(cmbMedicineName.SelectedValue);

            if (recipeDetailController.AddRecipeDetail(recipe, medicineId))
            {
                lstMedicineList.Items.Add(cmbMedicineName.Text);
                MessageBox.Show("İlaç eklendi");
            }
            else
            {
                MessageBox.Show("İlaç eklenemedi");
            }
        }
예제 #7
0
        public async Task RecipeController_GetRecipe_WithProjectPath()
        {
            var directoryManager        = new DirectoryManager();
            var fileManager             = new FileManager();
            var projectDefinitionParser = new ProjectDefinitionParser(fileManager, directoryManager);

            var mockCustomRecipeLocator = new Mock <ICustomRecipeLocator>();

            var sourceProjectDirectory = SystemIOUtilities.ResolvePath("WebAppWithDockerFile");

            var customLocatorCalls = 0;

            mockCustomRecipeLocator
            .Setup(x => x.LocateCustomRecipePaths(It.IsAny <string>(), It.IsAny <string>()))
            .Callback <string, string>((csProjectPath, solutionPath) =>
            {
                customLocatorCalls++;
                Assert.Equal(new DirectoryInfo(sourceProjectDirectory).FullName, Directory.GetParent(csProjectPath).FullName);
            })
            .Returns(Task.FromResult(new HashSet <string>()));

            var projectDefinition = await projectDefinitionParser.Parse(sourceProjectDirectory);

            var recipeDefinitions = await RecipeHandler.GetRecipeDefinitions(mockCustomRecipeLocator.Object, projectDefinition);

            var recipe = recipeDefinitions.First();

            Assert.NotEqual(0, customLocatorCalls);

            customLocatorCalls = 0;
            var recipeController = new RecipeController(mockCustomRecipeLocator.Object, projectDefinitionParser);
            var response         = await recipeController.GetRecipe(recipe.Id, sourceProjectDirectory);

            Assert.NotEqual(0, customLocatorCalls);

            var result       = Assert.IsType <OkObjectResult>(response);
            var resultRecipe = Assert.IsType <RecipeSummary>(result.Value);

            Assert.Equal(recipe.Id, resultRecipe.Id);
        }
예제 #8
0
    public void Create()
    {
        GetQuantaty();
        GameObject Output = RecipeController.GetRecipe();

        int[] takeFromInventory = new int[8];
        int[] takeFromStation   = new int[8];
        for (int i = 0; i < 8; i++)
        {
            if (slots[i].typeOfItem != null)
            {
                if (slots[i].unitCount <= supplyCalculator(slots[i].typeOfItem, out takeFromInventory[i], out takeFromStation[i]))
                {
                }
                else
                {
                    Debug.Log("eksik" + slots[i].typeOfItem);
                    return;
                }
            }
        }

        for (int i = 0; i < 8; i++)
        {
            if (slots[i].unitCount * Count > takeFromStation[i])
            {
                Station.BackTransaction(slots[i].typeOfItem, takeFromStation[i]);
                int surplus = (int)(slots[i].unitCount * Count - takeFromStation[i]);
                InventoryOfPlayer.BackTransaction(slots[i].typeOfItem, surplus);
            }
            else
            {
                Station.BackTransaction(slots[i].typeOfItem, (int)slots[i].unitCount * Count);
            }
        }
        PlayerController.current.GetComponent <Station>().Create(Output, Count);
        //GameObject[] outputAndCurrent = new GameObject[2] { Output, PlayerController.current };
        //StartCoroutine("animateAndCreate", outputAndCurrent);
    }
예제 #9
0
        public async Task RecipeController_GetRecipe_HappyPath()
        {
            var directoryManager              = new DirectoryManager();
            var fileManager                   = new FileManager();
            var deploymentManifestEngine      = new DeploymentManifestEngine(directoryManager, fileManager);
            var consoleInteractiveServiceImpl = new ConsoleInteractiveServiceImpl();
            var consoleOrchestratorLogger     = new ConsoleOrchestratorLogger(consoleInteractiveServiceImpl);
            var commandLineWrapper            = new CommandLineWrapper(consoleOrchestratorLogger);
            var customRecipeLocator           = new CustomRecipeLocator(deploymentManifestEngine, consoleOrchestratorLogger, commandLineWrapper, directoryManager);
            var projectDefinitionParser       = new ProjectDefinitionParser(fileManager, directoryManager);

            var recipeController  = new RecipeController(customRecipeLocator, projectDefinitionParser);
            var recipeDefinitions = await RecipeHandler.GetRecipeDefinitions(customRecipeLocator, null);

            var recipe = recipeDefinitions.First();

            var response = await recipeController.GetRecipe(recipe.Id);

            var result       = Assert.IsType <OkObjectResult>(response);
            var resultRecipe = Assert.IsType <RecipeSummary>(result.Value);

            Assert.Equal(recipe.Id, resultRecipe.Id);
        }
예제 #10
0
    void UIArrangements()
    {
        GameObject Output = RecipeController.GetRecipe();

        /*if (PlayerController.current.GetComponent<Station>().crafting)
         * {*/
        if (Output != null)
        {
            if (Output.GetComponent <MealMaterial>() != null)
            {
                avatar.GetComponent <Image>().sprite = Output.GetComponent <MealMaterial>().image;
                avatar.GetComponent <Image>().color  = Color.white;
                label.GetComponent <Text>().text     = Output.name;
                GameObject definition = transform.parent.GetChild(3).gameObject;
                definition.GetComponent <Text>().text = Output.GetComponent <MealMaterial>().Definition;
                GameObject Time = transform.parent.GetChild(10).GetChild(0).gameObject;
                if (!PlayerController.current.GetComponent <Station>().crafting)
                {
                    int    unitTimeTimesCount = Mathf.FloorToInt(Output.GetComponent <MealMaterial>().unitTime *Count);
                    int    minute             = Mathf.FloorToInt(unitTimeTimesCount / 60);
                    int    second             = unitTimeTimesCount % 60;
                    string _time = minute.ToString("00") + ":" + second.ToString("00");
                    Time.GetComponent <Text>().text = _time;
                }
                else
                {
                    float  unitTimeTimesCount = PlayerController.current.GetComponent <Station>().Counter;
                    int    minute             = Mathf.FloorToInt(unitTimeTimesCount / 60);
                    int    second             = (int)unitTimeTimesCount % 60;
                    string _time = minute.ToString("00") + ":" + second.ToString("00");
                    Time.GetComponent <Text>().text = _time;
                }
                transform.parent.GetChild(11).GetComponent <Text>().text      = "gr";
                transform.parent.GetChild(11).GetComponent <Text>().alignment = TextAnchor.MiddleCenter;
            }
            else if (Output.GetComponent <Meal>() != null)
            {
                avatar.GetComponent <Image>().sprite = Output.GetComponent <Meal>().image;
                avatar.GetComponent <Image>().color  = Color.white;
                label.GetComponent <Text>().text     = Output.name;
                GameObject definition = transform.parent.GetChild(3).gameObject;
                definition.GetComponent <Text>().text = Output.GetComponent <Meal>().Definition;
                GameObject Time = transform.parent.GetChild(10).GetChild(0).gameObject;
                if (!PlayerController.current.GetComponent <Station>().crafting)
                {
                    int    unitTimeTimesCount = Mathf.FloorToInt(Output.GetComponent <Meal>().unitTime *Count);
                    int    minute             = Mathf.FloorToInt(unitTimeTimesCount / 60);
                    int    second             = unitTimeTimesCount % 60;
                    string _time = minute.ToString("00") + ":" + second.ToString("00");
                    Time.GetComponent <Text>().text = _time;
                }
                else
                {
                    float  unitTimeTimesCount = PlayerController.current.GetComponent <Station>().Counter;
                    int    minute             = Mathf.FloorToInt(unitTimeTimesCount / 60);
                    int    second             = (int)unitTimeTimesCount % 60;
                    string _time = minute.ToString("00") + ":" + second.ToString("00");
                    Time.GetComponent <Text>().text = _time;
                }

                transform.parent.GetChild(11).GetComponent <Text>().text      = "Por.";
                transform.parent.GetChild(11).GetComponent <Text>().alignment = TextAnchor.MiddleRight;
            }
            else
            {
                avatar.GetComponent <Image>().sprite = defaultSprite;
            }
            //}
        }


        for (int i = 0; i < 8; i++)
        {
            if (slots[i].typeOfItem != null)
            {
                slotUIs[i].SetActive(true);
                GameObject image = slotUIs[i].transform.GetChild(1).gameObject;
                GameObject label = slotUIs[i].transform.GetChild(2).gameObject;
                Text       text  = slotUIs[i].transform.GetChild(3).GetComponent <Text>();
                text.text = slots[i].typeOfItem.name;
                image.GetComponent <Image>().sprite = slots[i].GetSprite();
                image.GetComponent <Image>().color  = Color.white;
                label.GetComponent <Text>().text    = supplyCalculator(slots[i].typeOfItem) + "/" + slots[i].unitCount * Count;//buraya station deposundaki + inventorydeki malzeme miktarinin toplami yazilacaak
            }
            else
            {
                slotUIs[i].SetActive(false);

                /*
                 * GameObject image = slotUIs[i].transform.GetChild(1).gameObject;
                 * GameObject label = slotUIs[i].transform.GetChild(2).gameObject;
                 * image.GetComponent<Image>().sprite = defaultSprite;
                 * label.GetComponent<Text>().text = "0";*/
            }
        }
    }