Exemple #1
0
        public void CreateShipmentAddNewShipmentToDataBase()
        {
            var optionsBuilder = new DbContextOptionsBuilder <ApplicationDbContext>()
                                 .UseInMemoryDatabase("nameOfDatabase");

            var db = new ApplicationDbContext(optionsBuilder.Options);

            var input = new OfferInputModel()
            {
                From              = 1,
                To                = 17,
                CountOfPallets    = 3,
                Length            = 1.74,
                Width             = 2,
                Height            = 2,
                Weight            = 500,
                IsExpressDelivery = true,
                IsFragile         = true
            };

            var homeService = new HomeService(db);

            homeService.CreateShipment(input);

            int result = db.Shipments.Count();

            Assert.Equal(1, result);
        }