public TestContext(bool isSave) { if (Thread.CurrentThread.Name == null) { Thread.CurrentThread.Name = "UNIT TEST"; } this.isSave = isSave; var factory = new FakeNodeServiceFactory(); ConnectionService = services.Add(factory.CreateConnectionService()); DatabaseService = services.Add(factory.CreateDatabaseService()); LiveService = services.Add(factory.CreateLiveService()); LedgerService = services.Add(factory.CreateLedgerService()); DataTransformationService = services.Add(factory.CreateDataTransformationService()); if (this.isSave) { WipeDatabase(); } DatabaseService.IsSave = isSave; services.Initialize(); services.Start(); dummyLedgerCreator = new DummyLedgerCreator(LedgerService, LiveService); }
public LoginWindowViewModel(ILiveService liveAuthService, IConfigurationService configurationService) { if (liveAuthService == null) throw new ArgumentNullException("liveAuthService"); if (configurationService == null) throw new ArgumentNullException("configurationService"); _liveAuthService = liveAuthService; _configurationService = configurationService; Loaded = new RelayCommand(() => { var loginUrl = _liveAuthService.GetLoginUrl(); this.CurrentPage = new Uri(loginUrl, UriKind.Absolute); }); Navigated = new RelayCommand<NavigationEventArgs>((args) => { if (args.Uri.AbsoluteUri.StartsWith("https://login.live.com/oauth20_desktop.srf")) { var continueProcessing = false; var parsedQueryParameters = HttpUtility.ParseQueryString(args.Uri.Query); var authorizationCode = parsedQueryParameters["code"]; if (authorizationCode != null) { _liveAuthService.GetTokens(authorizationCode); continueProcessing = true; } Messenger.Default.Send<CloseLoginWindow>(new CloseLoginWindow(continueProcessing)); } }); }
public ClipboardService(IConfigurationService configurationService, ILiveService liveService, INotificationService notificationService) { _configurationService = configurationService; _liveService = liveService; _notificationService = notificationService; ConfigureDropListener(); }
public LiveController(ILiveService liveService, IIdentityProvider identityProvider) { Guard.WhenArgument(liveService, nameof(ILiveService)).IsNull().Throw(); Guard.WhenArgument(identityProvider, nameof(IIdentityProvider)).IsNull().Throw(); this.liveService = liveService; this.identityProvider = identityProvider; }
public ClipboardService(IConfigurationService configurationService, ILiveService liveService, INotificationService notificationService) { _configurationService = configurationService; _liveService = liveService; _notificationService = notificationService; ConfigureDropListener(); }
public void ThrowArgumentNullException_WhenILiveServiceParameterIsNull() { // Arrange ILiveService liveService = null; var identityProvider = new Mock <IIdentityProvider>(); // Act & Assert Assert.That( () => new LiveController(liveService, identityProvider.Object), Throws.InstanceOf <ArgumentNullException>().With.Message.Contains(nameof(ILiveService))); }
public BlockchainNode(ServiceManager services) { if (!NodeConfiguration.IsInitialized()) { NodeConfiguration.Initialize(); } var factory = new RealNodeServiceFactory(NodeConfiguration.GetNetwork()); ConnectionService = services.Add(factory.CreateConnectionService()); DatabaseService = services.Add(factory.CreateDatabaseService()); LiveService = services.Add(factory.CreateLiveService()); LedgerService = services.Add(factory.CreateLedgerService()); DataTransformationService = services.Add(factory.CreateDataTransformationService()); }
public LoginWindowViewModel(ILiveService liveAuthService, IConfigurationService configurationService) { if (liveAuthService == null) { throw new ArgumentNullException("liveAuthService"); } if (configurationService == null) { throw new ArgumentNullException("configurationService"); } _liveAuthService = liveAuthService; _configurationService = configurationService; Loaded = new RelayCommand(() => { var loginUrl = _liveAuthService.GetLoginUrl(); this.CurrentPage = new Uri(loginUrl, UriKind.Absolute); }); Navigated = new RelayCommand <NavigationEventArgs>((args) => { if (args.Uri.AbsoluteUri.StartsWith("https://login.live.com/oauth20_desktop.srf")) { var continueProcessing = false; var parsedQueryParameters = HttpUtility.ParseQueryString(args.Uri.Query); var authorizationCode = parsedQueryParameters["code"]; if (authorizationCode != null) { _liveAuthService.GetTokens(authorizationCode); continueProcessing = true; } Messenger.Default.Send <CloseLoginWindow>(new CloseLoginWindow(continueProcessing)); } }); }
public LiveController(ILiveService liveService) { _liveService = liveService; }
public LiveControllerTests() { _services = new LiveServiceMock(); _controller = new LiveController(_services); }
public DummyLedgerCreator(ILedgerService ledgerService, ILiveService liveService) { liveService.TransactionManager.TransactionReceived += tx => pendingTransactions.Add(tx); this.ledgerService = ledgerService; }