Exemple #1
0
        public OnboardingServiceTests()
        {
            _csvReportGenerator = new CsvReportGenerator();

            _agenciesService = new AgenciesService(
                CreateMapper(),
                DbContextProvider.GetSqlServerDbContext());

            _venuesService = new VenuesService(
                CreateMapper(),
                DbContextProvider.GetSqlServerDbContext());

            _userManagerMock = IdentityMocksProvider.GetMockUserManager();

            var fixture = new Fixture();

            var signingKey = new SymmetricSecurityKey(Encoding.Default.GetBytes(fixture.Create <string>()));

            _jwtConfiguration = fixture
                                .Build <JwtConfiguration>()
                                .With(config => config.SigningCredentials, new SigningCredentials(signingKey, SecurityAlgorithms.HmacSha256))
                                .Create();

            var jwtFactory = new JwtFactory(CreateJwtFactoryConfiguration());

            _usersService = new UsersService(
                _userManagerMock.Object,
                jwtFactory,
                CreateMapper());

            _peopleService = new PeopleService(
                CreateMapper(),
                DbContextProvider.GetSqlServerDbContext(),
                _usersService);

            _weddingsService = new WeddingsService(
                CreateMapper(),
                DbContextProvider.GetSqlServerDbContext());

            _onboardingService = new OnboardingService(
                CreateMapper(),
                DbContextProvider.GetSqlServerDbContext(),
                _agenciesService,
                _csvReportGenerator,
                _venuesService,
                _peopleService,
                _weddingsService);
        }
Exemple #2
0
        public MainPage()
        {
            this.InitializeComponent();

            MainPageDispatcher = Window.Current.Dispatcher;

            UpdateBoardInfo();
            UpdateNetworkInfo();
            UpdateDateTime();
            UpdateConnectedDevices();

            NetworkInformation.NetworkStatusChanged += NetworkInformation_NetworkStatusChanged;

            timer          = new DispatcherTimer();
            timer.Tick    += timer_Tick;
            timer.Interval = TimeSpan.FromSeconds(30);
            timer.Start();

            OnboardingService = new OnboardingService();
        }
Exemple #3
0
        public MainPage()
        {
            this.InitializeComponent();

            MainPageDispatcher = Window.Current.Dispatcher;

            UpdateBoardInfo();
            UpdateNetworkInfo();
            UpdateDateTime();
            UpdateConnectedDevices();

            NetworkInformation.NetworkStatusChanged += NetworkInformation_NetworkStatusChanged;

            timer = new DispatcherTimer();
            timer.Tick += timer_Tick;
            timer.Interval = TimeSpan.FromSeconds(30);
            timer.Start();

            OnboardingService = new OnboardingService();
        }
Exemple #4
0
        public MainPage()
        {
            this.InitializeComponent();

            // This is a static public property that allows downstream pages to get a handle to the MainPage instance
            // in order to call methods that are in this class.
            Current = this;

            MainPageDispatcher = Window.Current.Dispatcher;

            NetworkInformation.NetworkStatusChanged += NetworkInformation_NetworkStatusChanged;

            OnboardingService = new OnboardingService();

            this.NavigationCacheMode = NavigationCacheMode.Enabled;

            this.DataContext = LanguageManager.GetInstance();

            this.Loaded += (sender, e) =>
            {
                UpdateBoardInfo();
                UpdateNetworkInfo();
                UpdateDateTime();
                UpdateConnectedDevices();

                timer          = new DispatcherTimer();
                timer.Tick    += timer_Tick;
                timer.Interval = TimeSpan.FromSeconds(30);
                timer.Start();
            };
            this.Unloaded += (sender, e) =>
            {
                timer.Stop();
                timer = null;
            };
        }
Exemple #5
0
 public void Setup()
 {
     now           = DateTime.Now;
     companyAmazon = new Company {
         Id = 1, Name = "Amazon", Classification = Classification.Silver
     };
     customer = new Customer
     {
         HasCreditLimit = true,
         DateOfBirth    = new DateTime(1987, 08, 15),
         EmailAddress   = "*****@*****.**",
         Firstname      = "Lehlohonolo",
         Surname        = "Letaoana"
     };
     mockAccessDatabase        = new Mock <IAccessDatabase>();
     mockCustomerCreditService = new Mock <ICustomerCreditService>();
     mockCustomerCreditService
     .Setup(x => x.GetCreditLimit(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <DateTime>()))
     .Returns(500);
     mockAccessDatabase.Setup(x => x.GetCompanyById(It.IsAny <int>())).Returns(companyAmazon);
     mockAccessDatabase.Setup(db => db.GetCustomer(customer.EmailAddress)).Returns(customer);
     onboardingService = new OnboardingService(mockAccessDatabase.Object, mockCustomerCreditService.Object);
     accessDatabase    = mockAccessDatabase.Object;
 }