public async System.Threading.Tasks.Task GetBookingBySalesUnitIDAsync_Check_ArgumentNullException()
        {
            //Arrange
            var option  = DbContextHelper.CreateNewContextOptions();
            var context = new AppDbContext(option);

            DbContextHelper.SeedCorrectDuration(context);
            var _dlController = new DLController(context);

            //Act
            //Assert
            Assert.ThrowsAsync(typeof(ArgumentNullException), async() => { await _dlController.GetBookingBySalesUnitIDAsync(null, null, null); });
        }
        public async System.Threading.Tasks.Task GetBookingBySalesUnitIDAsync_Check_InvalidPageCount()
        {
            //Arrange
            var option  = DbContextHelper.CreateNewContextOptions();
            var context = new AppDbContext(option);

            DbContextHelper.SeedCorrectDuration(context);
            var _dlController = new DLController(context);

            //Act
            //Assert
            Assert.ThrowsAsync(typeof(IndexOutOfRangeException), async() => { await _dlController.GetBookingBySalesUnitIDAsync(1, 10, 100); });
        }
        public async System.Threading.Tasks.Task GetBookingBySalesUnitIDAsync_CheckReturnDataCorrectness()
        {
            //Arrange
            var option  = DbContextHelper.CreateNewContextOptions();
            var context = new AppDbContext(option);

            DbContextHelper.SeedCorrectDuration(context);
            var _dlController = new DLController(context);

            //Act
            var items = await _dlController.GetBookingBySalesUnitIDAsync(1, 1, 10);

            //Assert
            Assert.Equal(5, items.TotalCount);
        }
        public async System.Threading.Tasks.Task GetBookingBySalesUnitIDAsync_ReturnType()
        {
            //Arrange
            var option  = DbContextHelper.CreateNewContextOptions();
            var context = new AppDbContext(option);

            DbContextHelper.SeedCorrectDuration(context);
            var _dlController = new DLController(context);

            //Act
            var items = await _dlController.GetBookingBySalesUnitIDAsync(1, 1, 1);

            //Assert
            Assert.IsAssignableFrom <BookingPage>(items);
        }
        public async System.Threading.Tasks.Task BookingSearchAsync_ReturnType()
        {
            //Arrange
            var option  = DbContextHelper.CreateNewContextOptions();
            var context = new AppDbContext(option);

            DbContextHelper.SeedCorrectDuration(context);
            var _dlController = new DLController(context);

            //Act
            var items = await _dlController.BookingSearchAsync(1, "1", 1);

            //Assert
            Assert.IsAssignableFrom <List <UIBooking> >(items);
        }
        public async System.Threading.Tasks.Task GetSalesUnitsAsync_CheckReturnDataCorrectness()
        {
            //Arrange
            var option  = DbContextHelper.CreateNewContextOptions();
            var context = new AppDbContext(option);

            DbContextHelper.SeedCorrectDuration(context);
            var _dlController = new DLController(context);

            //Act
            var items = await _dlController.GetSalesUnitsAsync();

            //Assert
            Assert.Equal(4321, items.First(a => a.Id == 3).TotalPrice);
        }
        public async System.Threading.Tasks.Task GetSalesUnitsAsync_NullItems()
        {
            //Arrange
            var option  = DbContextHelper.CreateNewContextOptions();
            var context = new AppDbContext(option);

            DbContextHelper.SeedWrongDuration(context);
            var _dlController = new DLController(context);

            //Act
            var items = await _dlController.GetSalesUnitsAsync();

            //Assert
            Assert.True(items == null);
        }
예제 #8
0
 /// <summary>
 /// class Constructor which appect the DBContext initialized while starting up the application using DI.
 /// </summary>
 /// <param name="context">Entity framework DB context</param>
 public DreamlineController(AppDbContext context)
 {
     _context      = context;
     _dlController = new DLController(_context);
 }