Пример #1
0
        public async Task GetAllWarehousesShouldReturnAllWarehouses()
        {
            var options = new DbContextOptionsBuilder <WHMSDbContext>().UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options;

            using var context = new WHMSDbContext(options);
            for (int i = 0; i < 5; i++)
            {
                await context.Warehouses.AddAsync(new Warehouse
                {
                    Address = new Address
                    {
                        City          = "Test",
                        StreetAddress = "Test",
                        ZIP           = "test",
                        Country       = "Test",
                    },
                    Name = "Test",
                });
            }

            await context.SaveChangesAsync();

            var service = new WarehouseService(context);

            var warehouses       = service.GetAllWarehouses <WarehouseViewModel>();
            var warehousessCount = warehouses.ToList().Count();
            var exepcetedCount   = context.Warehouses.Count();

            Assert.Equal(exepcetedCount, warehousessCount);
        }
Пример #2
0
        public EditDeviceForm(Device device)
        {
            InitializeComponent();
            this.EnableGlass = false;

            comboBoxEx1.DisplayMember = "Name";
            comboBoxEx1.ValueMember   = "Id";
            comboBoxEx1.DataSource    = WarehouseService.GetAllWarehouses();


            _device = device;
            bindingSource1.DataSource = _device;
        }
Пример #3
0
 private void LoadData()
 {
     dataGridViewX1.DataSource = WarehouseService.GetAllWarehouses();
 }