public NormalEdge( Factories.Factories factories, IRouteElement parent, Vector2 location ) : base( factories, Styles.NormalStyle, parent ) { this._parent = parent; this.StartPoint.SetLocation( location - new Vector2( 0, Constans.RoadHeight / 2 ) ); this.EndPoint.SetLocation( location + new Vector2( 0, Constans.RoadHeight / 2 ) ); }
public InsertRoadJunctionFourBlocksCommand( IMouseInformation mouseInformation, Factories.Factories factories, IEventAggregator eventAggregator ) { this._factories = factories; this._mouseInformation = mouseInformation.NotNull(); this._mouseInformation.LeftButtonPressed.Subscribe( this.AddJunction ); }
public EndRoadLaneEdge( Factories.Factories factories, MovablePoint startPoint, MovablePoint endPoint, RoadLaneBlock parent ) : base( factories, startPoint, endPoint, Styles.NormalStyle, parent ) { this._parrent = parent; this._notMovableMouseHandler = factories.MouseHandlerFactory.CreateEmpty(); this.Connector = new EndRoadLaneEdgeConnector( this ); }
public TopicWorker(Factories.TopicFactory factory, Map map, Topic parentTopic, ITopicConnection connectionType) { _topic = factory.CreateTopic(map, parentTopic); _topicPointer = factory.CreateTopicPointer(connectionType); _topic.Pointer = _topicPointer; }
public InternalRoadJunctionEdge( Factories.Factories factories, RoadJunctionBlock roadJunctionBlock, int index ) : base( factories, Styles.NormalStyle, roadJunctionBlock ) { this._vertexContainer = new InternalRoadJunctionEdgeVertexContainer( this ); this._parent = roadJunctionBlock; this.EdgeIndex = index; }
public InsulinViewModel(Insulin insulin, Factories factories, IList<InsulinCircumstanceViewModel> allCircumstances) { Insulin = insulin; this.factories = factories; this.allCircumstances = allCircumstances; }
public void TestInitialize() { var fixture = new Fixture(); factories = Substitute.For<Factories>(); navigator = Substitute.For<Navigator>(); stateProvider = Substitute.For<StateProvider>(); facade = Substitute.For<ReplacementBuilderAndSugarEstimatorFacade>(); clipboard = Substitute.For<Clipboard>(); messageDialog = Substitute.For<MessageDialog>(); navigation = new InsulinEditingViewModel.Navigation(); CreateSut(); insulin = fixture.Create<Insulin>(); insulin.InitializeCircumstances(new List<Guid>()); insulin.SetOwner(factories); sugar = new Sugar(); sugar.SetOwner(factories); factories.InsulinCircumstances.Returns(fixture.CreateMany<InsulinCircumstance>().ToList()); factories.CreateSugar().Returns(sugar); settings = new Settings { MaxBolus = 5 }; factories.Settings.Returns(settings); meal = fixture.Create<Meal>(); factories.Finder.FindMealByInsulin(insulin).Returns(meal); factories.Finder.FindInsulinById(insulin.Id).Returns(insulin); var replacementAndEstimatedSugars = new ReplacementAndEstimatedSugars(); replacementAndEstimatedSugars.EstimatedSugars = new List<Sugar>(); replacementAndEstimatedSugars.Replacement = new Replacement { InsulinTotal = new Insulin(), Items = new List<ReplacementItem>() }; facade.GetReplacementAndEstimatedSugars(Arg.Any<Meal>(), Arg.Any<Insulin>(), Arg.Any<Sugar>()) .Returns(replacementAndEstimatedSugars); factories.MealNames.Returns(new List<MealName>()); stateProvider.State.Returns(new Dictionary<string, object>()); }
public LinkThumbnailScreenFactory(CompositionContainer compositionContainer, Factories.ImageThumbnailScreenFactory imageThumbnailScreenFactory) { _imageThumbnailScreenFactory = imageThumbnailScreenFactory; compositionContainer.ComposeParts(this); }
public SettingsViewModel(Factories factories, LearningCuAndFpu learningCuAndFpu) { settings = factories.Settings; this.learningCuAndFpu = learningCuAndFpu; UiCultures = new List<string>(); ProductCultures = new List<string>(); BuildUiCulturesAndProductCultures(); }
public JournalViewModel(Factories factories, BackgroundWorkerFactory workerFactory, SugarEditingViewModel sugarEditing) { this.factories = factories; this.workerFactory = workerFactory; this.sugarEditing = sugarEditing; InitializeSugarEditing(); }
protected TweetRequester(ITwitterClient client, IRequestLimitStatus requestLimitStatus, Factories.TweetFactory tweetFactory) { Client = client; _requestLimitStatus = requestLimitStatus; _tweetFactory = tweetFactory; }
public void Initialize() { basedate = new DateTime(2013, 07, 24); factories = new FactoriesImpl(); factories.StorageCreator = new StorageCreatorStub(); AddProduct(1, energy: 100, carbs: 100, protein: 100, fat: 100); AddProduct(2, energy: 100, carbs: 100, protein: 100, fat: 100); AddProduct(3, energy: 100, carbs: 100, protein: 100, fat: 100); }
public MainWindow() { InitializeComponent(); var streamProvider = new DesktopBinaryStreamProvider(); storageCreator = new BinaryStorageCreator(streamProvider); factories = new FactoriesImpl(); factories.StorageCreator = storageCreator; storageCreator.CultureName = "en-US"; }
public GroupingJournalViewModel(Factories factories, BackgroundWorkerFactory workerFactory, SugarEditingViewModel sugarEditing) : base(factories, workerFactory, sugarEditing) { Grouping = new GroupingViewModel<JournalItemViewModel, DateViewModel>(this, () => Items, keySelector: item => item.Date, predicate: item => item.FilterIn(search), choose: Choose); }
public void TestInitialize() { factories = Substitute.For<Factories>(); fixture = new Fixture(); factories.Categories.Returns(fixture.CreateMany<Category>().ToList()); categories = factories.Categories.Select(category => new CategoryViewModel(category, factories)).ToList(); product = new Product { CategoryId = factories.Categories.First().Id }; product.SetOwner(factories); overrideCategory = new CategoryViewModel(new Category(), factories); }
public SelectToEditCommand( IMouseInformation mouseInformation, Factories.Factories factories, IEventAggregator eventAggregator, VisitAllChildren allControls ) { Contract.Requires( mouseInformation != null ); Contract.Requires( factories != null ); Contract.Requires( eventAggregator != null ); this._eventAggregator = eventAggregator; this._mouseInformation = mouseInformation; this._mouseInformation.LeftButtonClicked.Subscribe( this.OnLeftButtonClick ); this._allControl = allControls; }
public void Initialize() { Factories.Reset(); this.socket = new DummyAdbSocket(); Factories.AdbSocketFactory = (endPoint) => this.socket; this.commandLineClient = new DummyAdbCommandLineClient(); Factories.AdbCommandLineClientFactory = (version) => this.commandLineClient; }
private void Compute() { var currentPurchaseQuantity = Utils.ConvertToInteger(txtQuantity.Text); var unitPrice = Utils.ConvertToDouble(lblPrice.Text); var model = Factories.CreatePosTransaction().ComputeUpdateQuantity(initialAvailable, initialQuantity, currentPurchaseQuantity, unitPrice); lblAvailableQuantity.Text = model.AvailableQuantity.ToString(); lblTotal.Text = model.TotalAmount.ToString(); txtQuantity.SelectionStart = txtQuantity.Text.Length; }
public void AdicionarAssociado_GrupoNaoCadastrado_ThrowsCustomException() { var ciclo = Factories.CriarCicloValido(); var grupo = new Grupo("Grupo 1"); var usuario1 = new Usuario("12312312312", "111", "Usuário 1", "Cargo 1", "Área 1", ciclo.Empresa); var associado1 = new Associado(usuario1, grupo, 10, "1234"); var exception = Assert.Throws <CustomException>(() => ciclo.AdicionarAssociado(associado1)); Assert.Equal("Esse associado deve estar em um grupo habilitado para esse ciclo.", exception.Message); }
private void SetProductUnitPrice() { var productID = int.Parse(((ItemX)cboProducts.SelectedItem).Value); if (productID > 0) { var product = Factories.CreateProduct().Get(productID); txtUnitPrice.Text = product.UnitPrice.ToString(); } }
/// <summary> /// Unregister all factories<br/> /// 注销所有工厂函数<br/> /// </summary> public void UnregisterAll() { FactoriesLock.EnterWriteLock(); try { Factories.Clear(); } finally { FactoriesLock.ExitWriteLock(); } GC.Collect(); }
public ActionResult Edit([Bind(Include = "FactoryId,Name,Address,ABN,LegalName,isDeleted,CreatedDate,ModifiedDate")] Factories factories) { if (ModelState.IsValid) { db.Entry(factories).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(factories)); }
public void Setup() { Factories.MpCongregation(); _ministryPlatformService = new Mock <IMinistryPlatformService>(); _ministryPlatformRest = new Mock <IMinistryPlatformRestRepository>(); _authRepository = new Mock <IAuthenticationRepository>(); _configWrapper = new Mock <IConfigurationWrapper>(); _fixture = new CongregationRepository(_ministryPlatformService.Object, _ministryPlatformRest.Object, _authRepository.Object, _configWrapper.Object); }
private void LoadFactories() { Factories.Add(new InputModuleFactory()); Factories.Add(new OutputModuleFactory()); Factories.Add(new LevelControlModuleFactory()); Factories.Add(new SineSynthModuleFactory()); Factories.Add(new KeyTriggerModuleFactory()); Factories.Add(new SplitterModuleFactory <float>("Sound")); Factories.Add(new SplitterModuleFactory <double>("CV")); }
/// <summary> /// 添加实例 /// </summary> /// <param name="info"></param> /// <returns></returns> public virtual bool Set(FactoryInfo info) { if (info == null) { return(false); } Factories = Factories.Where(it => !it.Name.Equals(info.Name)).ToList(); Factories.Add(info); return(true); }
public override void Process(SceneReaderContext context) { context.VerifyWorld("MakeNamedMaterial"); var textureParams = new TextureParams(Parameters, context.GraphicsState.MaterialParams, context.GraphicsState.FloatTextures, context.GraphicsState.SpectrumTextures); context.GraphicsState.NamedMaterials[MaterialName] = Factories.MakeMaterial( MaterialType, context.CurrentTransform[0], textureParams); }
public ClientEngine (EngineSettings settings, Factories factories) { settings = settings ?? throw new ArgumentNullException (nameof (settings)); Factories = factories ?? throw new ArgumentNullException (nameof (factories)); // This is just a sanity check to make sure the ReusableTasks.dll assembly is // loadable. GC.KeepAlive (ReusableTasks.ReusableTask.CompletedTask); PeerId = GeneratePeerId (); Settings = settings ?? throw new ArgumentNullException (nameof (settings)); CheckSettingsAreValid (Settings); allTorrents = new List<TorrentManager> (); dhtNodeLocker = new SemaphoreSlim (1, 1); publicTorrents = new List<TorrentManager> (); Torrents = new ReadOnlyCollection<TorrentManager> (publicTorrents); DiskManager = new DiskManager (Settings, Factories); ConnectionManager = new ConnectionManager (PeerId, Settings, Factories, DiskManager); listenManager = new ListenManager (this); PortForwarder = Factories.CreatePortForwarder (); MainLoop.QueueTimeout (TimeSpan.FromMilliseconds (TickLength), delegate { if (IsRunning && !Disposed) LogicTick (); return !Disposed; }); downloadLimiter = new RateLimiter (); downloadLimiters = new RateLimiterGroup { new DiskWriterLimiter(DiskManager), downloadLimiter, }; uploadLimiter = new RateLimiter (); uploadLimiters = new RateLimiterGroup { uploadLimiter }; PeerListener = (settings.ListenEndPoint == null ? null : Factories.CreatePeerConnectionListener (settings.ListenEndPoint)) ?? new NullPeerListener (); listenManager.SetListener (PeerListener); DhtListener = (settings.DhtEndPoint == null ? null : Factories.CreateDhtListener (settings.DhtEndPoint)) ?? new NullDhtListener (); DhtEngine = (settings.DhtEndPoint == null ? null : Factories.CreateDht ()) ?? new NullDhtEngine (); Dht = new DhtEngineWrapper (DhtEngine); DhtEngine.SetListenerAsync (DhtListener).GetAwaiter ().GetResult (); DhtEngine.StateChanged += DhtEngineStateChanged; DhtEngine.PeersFound += DhtEnginePeersFound; LocalPeerDiscovery = new NullLocalPeerDiscovery (); RegisterLocalPeerDiscovery (settings.AllowLocalPeerDiscovery ? Factories.CreateLocalPeerDiscovery () : null); }
public PeerAEncryption(Factories factories, InfoHash infoHash, IList <EncryptionType> allowedEncryption, ReadOnlyMemory <byte> initialPayload) : base(factories, allowedEncryption) { if (allowedEncryption.Contains(EncryptionType.PlainText)) { throw new NotSupportedException("'PlainText' is an unsupported RC4 encryption type."); } InitialPayload = initialPayload; SKEY = infoHash; }
public void AccelerationTimedViewModel_SliderValueChanged_ChangesXValuesCorrectly() { var data = Factories.GetAccelerationData(); var model = new AccelerationTimedViewModel(data); model.SliderValueChanged(2); Assert.AreEqual(15f, model.LValFB); Assert.AreEqual(0f, model.RValFB); Assert.AreEqual("Forwards/Backwards: 15 m/s^2", model.FBText); }
public override async Task InitializeAsync() { await base.InitializeAsync(); AppId = await Factories.CreateAsync(nameof(AppName), async() => { var appId = await FindAppAsync(); if (appId != null) { return(appId); } try { await Client.Apps.PostAppAsync(new UpsertAppDto { Name = AppName, Languages = new List <string> { "en", "de" } }); } catch (NotifoException ex) { if (ex.StatusCode != 400) { throw; } } appId = await FindAppAsync(); string[] contributors = { "*****@*****.**" }; var invite = new AddContributorDto { Role = "Owner" }; foreach (var contributor in contributors) { invite.Email = contributor; await Client.Apps.PostContributorAsync(appId, invite); } return(appId); }); }
static public void SerializeProvinciesBinary(string unziptPath, string serializePath) { List <Provincie> provincies = Factories.ProvincieFactory(unziptPath); using (Stream stream = File.Open(@"" + serializePath + @"\provincies.dat", FileMode.Create)) { BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(stream, provincies); } System.Console.WriteLine("File serialized in " + serializePath + "\n"); }
public virtual async Task InitializeAsync() { Squidex = await Factories.CreateAsync(nameof(ClientManagerWrapper), async() => { var clientManager = new ClientManagerWrapper(); await clientManager.ConnectAsync(); return(clientManager); }); }
void SetData() { try { var model = Factories.CreateProductLog().GetProduct(productID); } catch (Exception ex) { LocalUtils.ShowErrorMessage(this, ex.Message); } }
public void AngleTimedViewModel_SliderValueChanged_YawChangesCorrectly() { var data = Factories.GetAngleData(); var model = new AngleTimedViewModel(data); model.SliderValueChanged(1); Assert.AreEqual(10f, model.LValYaw); Assert.AreEqual(0f, model.RValYaw); Assert.AreEqual("Yaw: 10°", model.YawText); }
public void AccelerationTimedViewModel_SliderValueChanged_ChangesZValuesCorrectly() { var data = Factories.GetAccelerationData(); var model = new AccelerationTimedViewModel(data); model.SliderValueChanged(2); Assert.AreEqual(15f, model.LValLR); Assert.AreEqual(0f, model.RValLR); Assert.AreEqual("Left/Right: 15 m/s^2", model.LRText); }
public void HeightViewModel_SliderValueChanged_ChangesToCorrectValues() { var data = Factories.GetHeightData(); var model = new HeightViewModel(data); model.slValueChanged(2); Assert.AreEqual(30f, model.HeightValL); Assert.AreEqual(0f, model.HeightValR); Assert.AreEqual("Height: 30 ft", model.HeightText); }
public GroupingProductListingViewModel(Factories factories, BackgroundWorkerFactory workerFactory) : base(factories, workerFactory) { Grouping = new SortedGroupingViewModel<ProductViewModel, CategoryViewModel, string, string>(this, () => Products, keySelector: product => product.Category, predicate: product => product.Name.ContainsIgnoringCase(search), choose: Choose, itemSort: product => product.Name, groupSort: group => group.Key.Name); }
public void TestInitialize() { factories = Substitute.For<Factories>(); providerFactory = Substitute.For<CloudProviderFactory>(); provider = Substitute.For<CloudProvider>(); providerFactory.Create().Returns(provider); exportAndImport = Substitute.For<ExportAndImport>(); settings = new Settings { CloudToken = "foo" }; factories.Settings.Returns(settings); sut = new CloudImpl(providerFactory, factories, exportAndImport); }
public void DeleteFactoryProject(Factories factory) { try { unitOfWork.Repository <Factories>().Delete(factory); } catch (Exception ex) { throw ex; } }
public string GetNameOf(IPacket packet) { try { return(Factories.First(x => x.IsMine(packet)).Name); } catch (Exception e) { throw e; } }
public EventParticipantControllerTest() { Factories.EventParticipantDTO(); _eventParticipantService = new Mock<IEventParticipantService>(); _fixture = new EventParticipantController(_eventParticipantService.Object, new Mock<IUserImpersonationService>().Object); authType = "auth_type"; authToken = "auth_token"; _fixture.Request = new HttpRequestMessage(); _fixture.Request.Headers.Authorization = new AuthenticationHeaderValue(authType, authToken); _fixture.RequestContext = new HttpRequestContext(); }
/// <summary> /// Register factory with service types and service key<br/> /// 根据多个服务类型和服务键注册工厂函数<br/> /// </summary> protected void RegisterFactoryMany( IEnumerable <Type> serviceTypes, ContainerFactoryData factoryData, object serviceKey) { foreach (var serviceType in serviceTypes) { var key = Pair.Create(serviceType, serviceKey); var factories = Factories.GetOrAdd( key, _ => new ConcurrentQueue <ContainerFactoryData>()); factories.Enqueue(factoryData); } }
/// <summary> /// Unregister all factories with specified service type and service key /// </summary> public void Unregister(Type serviceType, object serviceKey) { var key = Pair.Create(serviceType, serviceKey); FactoriesLock.EnterWriteLock(); try { Factories.Remove(key); } finally { FactoriesLock.ExitWriteLock(); } }
/// <summary> /// Get all gateways. /// Route: '/api/gateways' /// </summary> /// <returns>Array of gateways</returns> public static async Task <List <Gateway> > GetGateways() { try { string gateways = await http.Get("/api/gateways"); return(Factories.CreateCollection <Gateway>(gateways)); } catch { Console.WriteLine("Couldn't get Gateways"); throw; } }
/// <summary> /// Get Parking Lots. /// Route: '/api/parking-lots' /// </summary> /// <returns>Array of parking lots</returns> public static async Task <List <ParkingLot> > GetParkingLots() { try { string parkingLots = await http.Get("/api/parking-lots"); return(Factories.CreateCollection <ParkingLot>(parkingLots)); } catch { Console.WriteLine("Couldn't get Parking Lots"); throw; } }
IEnumerable <ICommandOutput> FetchRepoFound() { if (Href != null) { _fetchRepo = Factories.Select(x => x.FromUserInput(Href, _credentials)).NotNull().FirstOrDefault(); if (_fetchRepo == null) { yield return(new UnknownEndpointType(Href)); } } }
public async Task DeleteCoursesTest() { var mockPublisher = MockRedisStreamFactory <Course, DeletedEvent> .CreatePublisher(); var Course = Factories.CourseFactory(); var result = await new CoursesController().Delete(Course.Id, mockPublisher.Object) as OkObjectResult; mockPublisher.Verify(t => t.PublishAsync(It.Is <Course>(t => t.Id == Course.Id)), Times.Once); Assert.AreEqual(200, result.StatusCode); }
public string Serialize(T element) { string result = ""; if (Factories.ContainsKey(element.ElementName)) { result = Factories[element.ElementName].Serialize(element); } return(result); }
public CarsRemoverCommand( IMouseInformation mouseInformation, Factories.Factories factories, IEventAggregator eventAggregator ) { Contract.Requires( mouseInformation != null ); Contract.Requires( factories != null ); Contract.Requires( eventAggregator != null ); this._mouseInformation = mouseInformation; this._mouseInformation.LeftButtonPressed.Subscribe( s => { var carInserter = new CarsRemover( factories, s.Location ); eventAggregator.Publish( new AddControlToRoadLayer( carInserter ) ); } ); }
public ExportAndImportViewModel(Factories factories, CloudProviderFactory cloudProviderFactory, Vibration vibration, Cloud cloud, MessageDialog messageDialog, CloudMessages cloudMessages, BackgroundWorkerFactory workerFactory) { this.factories = factories; exportAndImport = new ExportAndImportImpl(factories); this.cloudProviderFactory = cloudProviderFactory; this.vibration = vibration; this.cloud = cloud; this.messageDialog = messageDialog; this.cloudMessages = cloudMessages; this.workerFactory = workerFactory; }
public void SetOwner(Factories value) { var alreadyAssigned = Owner != null; if (alreadyAssigned) { throw new InvalidOperationException("Owner can only be assigned once."); } if (value == null) { throw new NullReferenceException("Owner"); } Owner = value; OnOwnerAssigned(); }
public ReplacementItemViewModel(ReplacementItem replacementItem, Factories factories, IList<InsulinCircumstanceViewModel> allCircumstances, IEnumerable<MealNameViewModel> names, MealNameViewModel defaultName, Navigator navigator, Action save, Action<IList<PatternViewModel>> showAlternatives) { ReplacementItem = replacementItem; Func<Pattern, bool, PatternViewModel> createPatternViewModel = (pattern, hasAlternatives) => new PatternViewModel(pattern, factories, allCircumstances: allCircumstances, hasAlternatives: hasAlternatives, names: names, defaultName: defaultName, navigator: navigator, save: save, showAlternatives: ShowAlternatives); Pattern = createPatternViewModel(replacementItem.Pattern, replacementItem.Alternatives.Any()); Alternatives = replacementItem.Alternatives .Select(pattern => createPatternViewModel(pattern, false)) .ToList(); this.showAlternatives = showAlternatives; }
public void TestInitialize() { factories = Substitute.For<Factories>(); fixture = new Fixture(); factories.Finder.Returns(new FinderImpl(factories)); factories.CreateCategory().Returns(new Category()); factories.Categories.Returns(fixture.CreateMany<Category>().ToList()); factories.Products.Returns(fixture.CreateMany<Product>(5).ToList()); foreach (var product in factories.Products) { product.CategoryId = factories.Categories[1].Id; product.SetOwner(factories); } factories.MruProducts.Returns(new MruProductsImpl(new List<Guid>(), factories)); factories.Settings.Returns(new Settings()); viewModel = new ProductListingViewModel(factories, new BackgroundWorkerSyncFactory()); }
public void TestInitialize() { factories = Substitute.For<Factories>(); meal = new Meal(); sut = new MealViewModel(meal, factories); meal.SetOwner(factories); meal.InitializeItems(new List<MealItem>()); factories.CreateMealItem().Returns(_ => { var mealItem = new MealItem(); mealItem.SetOwner(factories); return mealItem; }); var fixture = new Fixture(); factories.Products.Returns(fixture.CreateMany<Product>(10).ToList()); factories.Finder.Returns(new FinderImpl(factories)); }
public void TestInitialize() { factories = new FactoriesImpl(); factories.StorageCreator = new StorageCreatorStub(); product = factories.CreateProduct(); product.EnergyPer100g = 100; product.EnergyPerServing = 100; var meal = factories.CreateMeal(); item = meal.AddItem(); item.ProductId = product.Id; sut = new MealItemViewModel(item, factories); gram = Unit.Gram.GetAbbreviation(); mililiter = Unit.Mililiter.GetAbbreviation(); servingSize = () => Unit.ServingSize.GetAbbreviationOrServingSizeDetalis(product); ounce = Unit.Ounce.GetAbbreviation(); pound = Unit.Pound.GetAbbreviation(); }
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() { factories = Substitute.For<Factories>(); cloudProviderFactory = Substitute.For<CloudProviderFactory>(); cloudProvider = Substitute.For<CloudProvider>(); cloudProviderFactory.Create().Returns(cloudProvider); settings = new Settings(); factories.Settings.Returns(settings); vibration = Substitute.For<Vibration>(); cloud = Substitute.For<Cloud>(); messageDialog = Substitute.For<MessageDialog>(); cloudMessages = new Fixture().Create<CloudMessages>(); workerFactory = new BackgroundWorkerSyncFactory(); sut = new ExportAndImportViewModel(factories, cloudProviderFactory, vibration, cloud, messageDialog, cloudMessages, workerFactory); cloudProvider.GetAcquiredToken().Returns(new CloudToken { Secret = "foo", Token = "bar" }); cloudProvider.GetTokenAcquiringUrl(ExportAndImportViewModel.TOKEN_ACQUIRING_CALLBACK_URL).Returns("go"); cloud.ListImports().Returns(new List<string>()); navigatedTo = string.Empty; sut.NavigateInBrowser += (_, url) => { navigatedTo = url; }; }
public PatternViewModel(Pattern pattern, Factories factories, IList<InsulinCircumstanceViewModel> allCircumstances, bool hasAlternatives, IEnumerable<MealNameViewModel> names, MealNameViewModel defaultName, Navigator navigator, Action save, Action showAlternatives) { Pattern = pattern; Match = new MealItemViewModel(pattern.Match, factories); From = new MealViewModel(pattern.From, factories); From.Names = names; From.DefaultName = defaultName; Insulin = new InsulinViewModel(pattern.Insulin, factories, allCircumstances: allCircumstances); Before = new SugarViewModel(pattern.Before, factories); After = pattern.After .Select(sugar => new SugarViewModel(sugar, factories)) .ToList(); For = new MealItemViewModel(pattern.For, factories); HasAlternatives = hasAlternatives; this.navigator = navigator; this.save = save; this.showAlternatives = showAlternatives; }
public void TestInitialize() { factories = Substitute.For<Factories>(); factories.Finder.Returns(new FinderImpl(factories)); SetupMeals(); SetupMealNames(); SetupProducts(); SetupCategories(); SetupSugars(); SetupInsulins(); factories.Settings.Returns(new Settings()); }
public DropboxProviderFactory(Factories factories) { this.factories = factories; }