예제 #1
0
        public void AddRecipe_NewCategory_NewCategoryCreated()
        {
            var newRecipe = new RecipeViewModel()
            {
                Categories   = "3", Ingredients = "cheese",
                Instructions = "just cook and eat", Name = "d", RecipeId = 4
            };

            recipeController.AddRecipe(newRecipe);

            navMenu.CategoriesMenuViewModels = NavMenu.GenerateMenu(context.Recipes.ToList());

            context.Recipes.Count().Should().Be(4);
            navMenu.CategoriesMenuViewModels.Count.Should().Be(3);
        }
예제 #2
0
        private void FormPatientRecipe_Load(object sender, EventArgs e)
        {
            cmbMedicineName.DataSource    = recipeDetailController.GetAllMedicine();
            cmbMedicineName.DisplayMember = "DrugName";
            cmbMedicineName.ValueMember   = "DrugId";

            string now      = (DateTime.Now - new DateTime(1970, 1, 1)).TotalMilliseconds.ToString();
            MD5    md5hash  = MD5.Create();
            string recipeNo = GetMd5Hash(md5hash, now);

            recipeNoSub      = recipeNo.Substring(2, 7);
            lblRecipeNo.Text = string.Format("Reçete Numarası : {0}", recipeNoSub);
            Recipe recipe = new Recipe()
            {
                RecipeNumber = recipeNoSub,
                PatientId    = patient.PatientId
            };

            if (recipeController.AddRecipe(recipe))
            {
                MessageBox.Show("Reçete oluşturuldu");
            }
            else
            {
                MessageBox.Show("Reçete oluşturulamadı.");
                this.Close();
            }
        }
예제 #3
0
        public void AddRecipeTest()
        {
            // Arrange
            var repo             = new FakeRecipeRepository();
            var recipeController = new RecipeController(repo);
            var ingredients      = new List <Ingredient>();

            // Act
            recipeController.AddRecipe("Smoothie",

                                       "2", "Put all ingredients in blender then blend on high", ingredients);

            // Assert
            Assert.Equal("Smoothie",

                         repo.Recipes[repo.Recipes.Count - 1].Name);
        }