예제 #1
0
        public void Is_CampaignRepository_CreateCampaign_Return_CampaignInfo(string name, string code, int duration,
                                                                             int limit, int tsCount, int expectedResult)
        {
            TestStartup.ConfigureServices();

            var repository = TestStartup.ServiceProvider.GetService <ICampaignRepository>();
            var campaign   = new Campaign
            {
                Name                 = name,
                ProductCode          = code,
                Duration             = duration,
                Limit                = limit,
                TargetSalesCount     = tsCount,
                Active               = true,
                Turnover             = 0,
                StartDate            = DateTime.Now,
                EndDate              = DateTime.Now.AddHours(6),
                TotalSales           = 0,
                AverageItemPrice     = 0,
                CampaignProductPrice = 0
            };

            var result = repository.AddCampaign(campaign);

            Assert.NotEqual(expectedResult, result.Id);

            TestStartup.DisposeServices();
        }
예제 #2
0
        public void Is_CampaignService_CreateCampaign_Return_CampaignInfo(string command, string expectedResult)
        {
            TestStartup.ConfigureServices();

            var service = TestStartup.ServiceProvider.GetService <ICampaignService>();
            var result  = service.CreateCampaign(command.Split(' '));

            Assert.NotEqual(expectedResult, result);

            TestStartup.DisposeServices();
        }
예제 #3
0
        public void Is_ProductService_CreateProduct_Return_ProductInfo(string command, string expectedResult)
        {
            TestStartup.ConfigureServices();

            var service = TestStartup.ServiceProvider.GetService <IProductService>();
            var result  = service.CreateProduct(command.Split(' '));

            Assert.Equal(expectedResult, result);

            TestStartup.DisposeServices();
        }
예제 #4
0
        public void Is_ProductRepository_CreateProduct_Return_ProductInfo(string code, int price, int stock,
                                                                          int expectedResult)
        {
            TestStartup.ConfigureServices();

            var repository = TestStartup.ServiceProvider.GetService <IProductRepository>();
            var product    = new Product
            {
                ProductCode = code, Price = price, Stock = stock
            };

            var result = repository.AddProduct(product);

            Assert.NotEqual(expectedResult, result.Id);

            TestStartup.DisposeServices();
        }