public void Setup() { _navigationServiceMock = new Mock <INavigationService>(); _mealService = new Mock <IMealDataService>(); _userService = new Mock <IUserDataService>(); _sut = new EmployeeHelpViewModel(_navigationServiceMock.Object, _mealService.Object, _userService.Object); Meal meal = new Meal { Id = 1 }; _sut.SelectedMeal = meal; User user = new User { Id = 1 }; _sut.SelectedUser = user; List <ScannedUser> userList = new List <ScannedUser>(); ScannedUser scannedUser1 = new ScannedUser { Id = 1 }; ScannedUser scannedUser2 = new ScannedUser { Id = 2 }; userList.Add(scannedUser1); userList.Add(scannedUser2); List <ScannedMeal> mealList = new List <ScannedMeal>(); ScannedMeal scannedMeal1 = new ScannedMeal { Id = 1 }; ScannedMeal scannedMeal2 = new ScannedMeal { Id = 2 }; mealList.Add(scannedMeal1); mealList.Add(scannedMeal2); _sut.ScanMeal = mealList; _sut.ScanUser = userList; }
public void Setup() { _navigationServiceMock = new Mock <INavigationService>(); _userServiceMock = new Mock <IUserDataService>(); _mealDataServiceMock = new Mock <IMealDataService>(); _scanServiceMock = new Mock <IScanService>(); _menuServiceMock = new Mock <IMenuDataService>(); scannedUsers = new List <ScannedUser>(); scannedUser = new ScannedUser(); scannedUser.Id = 1; scannedUsers.Add(scannedUser); scannedMeals = new List <ScannedMeal>(); scannedMeal = new ScannedMeal(); scannedMeal.Id = 1; scannedMeals.Add(scannedMeal); menu = new Shared.Models.Menu(); mealList = new ObservableCollection <Meal>(); meal1 = new Meal(); meal1.Id = 1; meal2 = new Meal(); meal2.Id = 2; mealList.Add(meal1); mealList.Add(meal2); menu.Meals = mealList; user = new User(); scannedUser.Id = 1; _scanServiceMock.Setup(f => f.MakeMealScan()).ReturnsAsync(scannedMeals); _scanServiceMock.Setup(f => f.MakePersonScan()).ReturnsAsync(scannedUsers); _menuServiceMock.Setup(f => f.GetLastMenu()).ReturnsAsync(menu); _userServiceMock.Setup(f => f.GetUserById(It.IsAny <int>())).ReturnsAsync(user); _mealDataServiceMock.Setup(f => f.GetMealById(It.IsAny <long>())).ReturnsAsync(meal1); _sut = new ScanResultViewModel(_scanServiceMock.Object, _navigationServiceMock.Object, _mealDataServiceMock.Object, _userServiceMock.Object, _menuServiceMock.Object); _sut.ScannedMeal = meal1; }