public void Setup() { _cameraViewModel = Substitute.For <ICameraViewModel>(); _backendConnection = Substitute.For <IBackendConnection>(); ObservableCollection <Item> list = new ObservableCollection <Item>(); Item item = new Item(); item.Name = "mælk"; item.Ean = "123"; list.Add(item); _backendConnection.GetListOfItems().Returns(list); _uut = new FindItemViewModel(_backendConnection, _cameraViewModel); }
public async Task <ActionResult <string> > GetAsync([FromQuery] FindItemViewModel model) { if (model == null) { model = new FindItemViewModel(); TryValidateModel(model); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var value = await _textKeyValueCacheService.ReadAsync(model.Key); return(Ok(value)); }
public void Setup() { _fakeVideoSource = Substitute.For <IVideoSource>(); _timer = new TimerClock(100); _barcodeReader = new ReadBarcode(); _fakeOutput = Substitute.For <IOutput>(); _camConnection = new CameraConnection(_timer, _barcodeReader, _fakeVideoSource, _fakeOutput); _soundPlayer = new SoundPlayer(_fakeOutput); _obj = new object(); _cameraViewModel = new CameraViewModel(_camConnection, _soundPlayer); _fakeBackendConnection = Substitute.For <IBackendConnection>(); ObservableCollection <Item> itemList = new ObservableCollection <Item>(); _item = new Item("Jordbær", "123", 7, 1); itemList.Add(_item); _fakeBackendConnection.GetListOfItems().Returns(itemList); _sut = new FindItemViewModel(_fakeBackendConnection, _cameraViewModel); }
public ScanEANWindow(FindItemViewModel ELA1) { ENO1 = new ScanEANViewModel(ELA1); InitializeComponent(); WindowStartupLocation = WindowStartupLocation.CenterScreen; }