Example #1
0
            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));
                }
            });
        }
Example #3
0
        public ClipboardService(IConfigurationService configurationService, ILiveService liveService, INotificationService notificationService)
        {
            _configurationService = configurationService;
            _liveService          = liveService;
            _notificationService  = notificationService;

            ConfigureDropListener();
        }
Example #4
0
        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();
        }
Example #6
0
        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)));
        }
Example #7
0
        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());
        }
Example #8
0
        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));
                }
            });
        }
Example #9
0
 public LiveController(ILiveService liveService)
 {
     _liveService = liveService;
 }
Example #10
0
 public LiveControllerTests()
 {
     _services   = new LiveServiceMock();
     _controller = new LiveController(_services);
 }
Example #11
0
 public DummyLedgerCreator(ILedgerService ledgerService, ILiveService liveService)
 {
     liveService.TransactionManager.TransactionReceived += tx => pendingTransactions.Add(tx);
     this.ledgerService = ledgerService;
 }