Ejemplo n.º 1
0
        internal static IHttpActionResult Insert()
        {
            var categoryResult = CategoryImplementaion.GetAll() as OkNegotiatedContentResult <IEnumerable <Category> >;
            var categorieList  = categoryResult.Content.ToList();

            var products = new List <Product>()
            {
                new Product()
                {
                    ID = Guid.NewGuid(), CategoryID = categorieList[0].ID, Name = "Name A", Price = 10000, Discount = 10
                },
                new Product()
                {
                    ID = Guid.NewGuid(), CategoryID = categorieList[0].ID, Name = "Name A", Price = 10000, Discount = 10
                },
                new Product()
                {
                    ID = Guid.NewGuid(), CategoryID = categorieList[0].ID, Name = "Name A", Price = 10000, Discount = 10
                },
            };

            var response = baseController.Insert(products);

            return(response);
        }
Ejemplo n.º 2
0
        public void Test_5_Delete()
        {
            //Act
            var response = CategoryImplementaion.Delete() as OkNegotiatedContentResult <IEnumerable <Guid> >;

            //Assert
            Assert.IsNotNull(response);
        }
Ejemplo n.º 3
0
        public void Test_4_GetByID()
        {
            //Act
            var response = CategoryImplementaion.GetByID() as OkNegotiatedContentResult <Category>;

            //Assert
            Assert.IsNotNull(response);
        }
Ejemplo n.º 4
0
        public void Test_3_GetAll()
        {
            //Act
            var response = CategoryImplementaion.GetAll() as OkNegotiatedContentResult <IEnumerable <Category> >;

            //Assert
            Assert.IsNotNull(response);
        }
Ejemplo n.º 5
0
        internal static IHttpActionResult Insert()
        {
            var categoryResult = CategoryImplementaion.GetAll() as OkNegotiatedContentResult <IEnumerable <Category> >;
            var categorieList  = categoryResult.Content.ToList();

            var codingResult = CodingImplementaion.GetAll() as OkNegotiatedContentResult <IEnumerable <Coding> >;
            var codingList   = codingResult.Content.ToList();

            var categoryAssignments = categorieList.Select(t => new CategoryAssignment
            {
                ID         = Guid.NewGuid(),
                CategoryID = t.ID,
                CodingID   = codingList[0].ID,
            }).ToList();

            var response = baseController.Insert(categoryAssignments);

            return(response);
        }