Ejemplo n.º 1
0
        public async Task Read_With_EmptyKeyword_Return_Success()
        {
            string           testName        = GetCurrentMethod();
            var              dbContext       = _dbContext(testName);
            IIdentityService identityService = new IdentityService {
                Username = "******"
            };

            var model = new GarmentBookingOrderItem()
            {
                GarmentBookingOrder = new GarmentBookingOrder()
            };

            dbContext.GarmentBookingOrderItems.Add(model);
            dbContext.SaveChanges();

            GarmentBookingOrderItemLogic unitUnderTest = new GarmentBookingOrderItemLogic(identityService, GetServiceProvider(testName).Object, dbContext);

            await unitUnderTest.DeleteAsync(model.Id);
        }
        protected override Mock <IServiceProvider> GetServiceProviderMock(SalesDbContext dbContext)
        {
            var serviceProviderMock = new Mock <IServiceProvider>();

            IIdentityService identityService = new IdentityService {
                Username = "******"
            };

            serviceProviderMock
            .Setup(x => x.GetService(typeof(IdentityService)))
            .Returns(identityService);

            var garmentBookingOrderItemLogic = new GarmentBookingOrderItemLogic(identityService, serviceProviderMock.Object, dbContext);
            var garmentBookingOrderLogic     = new GarmentBookingOrderLogic(garmentBookingOrderItemLogic, identityService, dbContext);

            serviceProviderMock
            .Setup(x => x.GetService(typeof(GarmentBookingOrderLogic)))
            .Returns(garmentBookingOrderLogic);

            return(serviceProviderMock);
        }
Ejemplo n.º 3
0
        public void GetBookingOrderIds_Return_Success()
        {
            string           testName        = GetCurrentMethod();
            var              dbContext       = _dbContext(testName);
            IIdentityService identityService = new IdentityService {
                Username = "******"
            };

            var model = new GarmentBookingOrderItem()
            {
                GarmentBookingOrder = new GarmentBookingOrder()
            };

            dbContext.GarmentBookingOrderItems.Add(model);
            dbContext.SaveChanges();

            GarmentBookingOrderItemLogic unitUnderTest = new GarmentBookingOrderItemLogic(identityService, GetServiceProvider(testName).Object, dbContext);

            HashSet <long> result = unitUnderTest.GetBookingOrderIds(model.Id);

            Assert.NotNull(result);
        }