Example #1
0
        public Lib.Models.GarmentProduct GetTestData(CoreDbContext dbContext)
        {
            Lib.Models.GarmentProduct data = new Lib.Models.GarmentProduct()
            {
                Code = "",
                Name = ""
            };
            dbContext.GarmentProducts.Add(data);
            dbContext.SaveChanges();

            return(data);
        }
Example #2
0
        public void GetDistinctProductWidth_Return_Ok()
        {
            //Setup
            CoreDbContext           dbContext       = GetDbContext(GetCurrentAsyncMethod());
            Mock <IServiceProvider> serviceProvider = GetServiceProvider();

            GarmentProductService service = new GarmentProductService(serviceProvider.Object);

            serviceProvider.Setup(s => s.GetService(typeof(GarmentProductService))).Returns(service);
            serviceProvider.Setup(s => s.GetService(typeof(CoreDbContext))).Returns(dbContext);

            Lib.Models.GarmentProduct testData = GetTestData(dbContext);

            //Act
            IActionResult response = GetController(service).GetDistinctProductWidth();


            //Assert
            int statusCode = this.GetStatusCode(response);

            Assert.Equal((int)HttpStatusCode.OK, statusCode);
        }