/// <summary> /// Default constructor /// </summary> public KeyboardListViewModel() { if (_keyboardRepository == null) { _keyboardRepository = new KeyboardRepository(); } AllKeyboards = new ObservableCollection <KeyboardStorage>(_keyboardRepository.GetKeyboards()); _keyboardList = new ObservableCollection <KeyboardStorage>(_keyboardRepository.GetKeyboards()); }
public void Paginator_CheckPaging_ReturnsthecorrectnumberofitemsAsync() { //Arrange var options = new DbContextOptionsBuilder <MechKeyboardBaseDbContext>() .UseInMemoryDatabase("KeyboardInMemoryDB") .Options; using (var context = new MechKeyboardBaseDbContext(options)) { context.Keyboard.Add(new Keyboard() { KeyboardId = 7, Username = "******", KeyboardName = "Test1d", Case = "test", PCB = "test", Plate = "test", Keycaps = "EPBT test", Switch = "test Inks" }); context.Keyboard.Add(new Keyboard() { KeyboardId = 8, Username = "******", KeyboardName = "Test1d", Case = "test", PCB = "test", Plate = "test", Keycaps = "EPBT test", Switch = "test Inks" }); context.Keyboard.Add(new Keyboard() { KeyboardId = 9, Username = "******", KeyboardName = "Test1d", Case = "test", PCB = "test", Plate = "test", Keycaps = "EPBT test", Switch = "test Inks" }); context.Keyboard.Add(new Keyboard() { KeyboardId = 10, Username = "******", KeyboardName = "Test1d", Case = "test", PCB = "test", Plate = "test", Keycaps = "EPBT test", Switch = "test Inks" }); context.Keyboard.Add(new Keyboard() { KeyboardId = 11, Username = "******", KeyboardName = "Test1d", Case = "test", PCB = "test", Plate = "test", Keycaps = "EPBT test", Switch = "test Inks" }); context.SaveChanges(); var keyboardRepository = new KeyboardRepository(context); //Act var listQuery = keyboardRepository.GetKeyboardsByPageAsync(2, 1); //Assert Assert.Single(listQuery.Result); } }