Ejemplo n.º 1
0
 public MainViewModel(Factories factories, Cloud cloud, TimerFactory timerFactory,
     BackgroundWorkerFactory workerFactory, MealEditingViewModel.BackNavigation mealEditingBackNavigation,
     JournalViewModel journal, ProductListingViewModel productListing, MealItemEditingViewModel mealItemEditing,
     MessageDialog messageDialog, WelcomeScreen welcomeScreen, CloudMessages cloudMessages)
 {
     this.factories = factories;
     this.cloud = cloud;
     this.timerFactory = timerFactory;
     this.workerFactory = workerFactory;
     this.mealEditingBackNavigation = mealEditingBackNavigation;
     this.journal = journal;
     this.productListing = productListing;
     this.mealItemEditing = mealItemEditing;
     this.messageDialog = messageDialog;
     this.cloudMessages = cloudMessages;
     WelcomeScreen = welcomeScreen;
     ShareStateProvider();
 }
 public void TestInitialize()
 {
     meal = new Meal { Id = Guid.NewGuid() };
     meal.InitializeItems(new List<MealItem>());
     factories = Substitute.For<Factories>();
     factories.Finder.FindMealById(meal.Id).Returns(meal);
     factories.MealNames.Returns(new List<MealName>());
     factories.MealNames.Add(new MealName { Id = Guid.NewGuid() });
     factories.DefaultEntities.MealName.Returns(new MealName { Id = Guid.NewGuid() });
     trial = Substitute.For<TrialViewModel>();
     backNavigation = new MealEditingViewModel.BackNavigation();
     messageDialog = Substitute.For<MessageDialog>();
     sut = new MealEditingViewModel(factories, new BackgroundWorkerSyncFactory(), trial, backNavigation,
         new MealItemEditingViewModel(), messageDialog);
     sut.Navigator = Substitute.For<Navigator>();
     stateProvider = Substitute.For<StateProvider>();
     sut.StateProvider = stateProvider;
     sut.Init(new MealEditingViewModel.Navigation { MealIdToEdit = meal.Id });
 }