Exemplo n.º 1
0
        public ClientStartup()
        {
            var metricMemoryRepository = new InMemoryRepository <MetricResult>();
            var alertHub        = new AlertHub();
            var healingExecutor = new HealingExecutor();

            _testExecutor = new TimedTestExecutor(new List <ITester>
            {
                new TcpTester(),
                new WebTester(),
                new ServiceTester(),
                new SslTester(),
                new PowershellTest()
            }, metricMemoryRepository,
                                                  alertHub,
                                                  healingExecutor);

            _metricCollector = new TimedMetricExecutor(new List <ICollector>
            {
                new ServerMetricCollector(),
                new RedisMetricCollector(),
                new RabbitMqCollector(),
                new ElasticSearchCollector(),
                new HaProxyCollector(),
                new SqlQueryCollector(metricMemoryRepository)
            }, metricMemoryRepository);

            var restMetricRepository = new RestRepository <MetricResult>();

            _metricTimedReporter = new TimedReporter <MetricResult>(metricMemoryRepository, restMetricRepository);

            _eventLogListener = new EventLogListener(metricMemoryRepository);
            _eventLogListener.Init();
        }
        public async Task RestRepository_Get_Test()
        {
            var httpClient = new Mock <HttpClient>();

            httpClient.Object.BaseAddress = new Uri("http://localhost/");

            var transformer = new QueryStringVehicleFilterTransformer();
            var repo        = new RestRepository <string, Vehicle, VehicleFilter>(httpClient.Object, transformer);

            var result = await repo.Get("1");

            result.ShouldNotBeNull();
        }
Exemplo n.º 3
0
        public void MakeInquiry_WhenCalled_ShouldCallProxyMakeInquiry()
        {
            // Arrange
            var mockProxy   = GetServiceProxy();
            var credentials = new Credentials();
            var repo        = new RestRepository(_userToken, credentials, mockProxy);
            var inquiry     = new PartyRelationshipsInquiry();

            // Act
            var dontCare = repo.MakeInquiry(inquiry);

            // Assert
            mockProxy.Received().MakeInquiry(Arg.Any <PartyRelationshipsInquiry>());
        }
Exemplo n.º 4
0
        protected async void ExecuteScan(object parameter)
        {
            try
            {
                if (string.IsNullOrEmpty(this.SearchPin) && string.IsNullOrEmpty(this.SearchKey))
                {
                    this.MessagePresenter.Show("Mohon diisi dengan lengkap !");
                }

                else if (!string.IsNullOrEmpty(this.SearchPin) && string.IsNullOrEmpty(this.SearchKey))
                {
                    this.MessagePresenter.Show("Meeting ID harap di isi");
                }

                else if (string.IsNullOrEmpty(this.SearchPin) && !string.IsNullOrEmpty(this.SearchKey))
                {
                    this.MessagePresenter.Show("Meeting Code harap di isi");
                }

                else if (!string.IsNullOrEmpty(this.SearchPin) && !string.IsNullOrEmpty(this.SearchKey))
                {
                    Meeting.MeetingPin = this.SearchPin;
                    Meeting.MeetingKey = this.SearchKey;

                    //RestRepositoryBase<Meeting> RepositoryMeeting = new RestRepositoryBase<Meeting>();
                    //Meeting Meetingin = await RepositoryMeeting.GetMeetingAsync(Meeting);

                    GetMeetingRequestParameter getMeetingRequestParameter = new GetMeetingRequestParameter();
                    getMeetingRequestParameter.MeetingPin = this.SearchPin;
                    getMeetingRequestParameter.MeetingKey = this.SearchKey;

                    Meeting Meetingin = await RestRepository.GetMeetingAsync(getMeetingRequestParameter);

                    if (Meetingin == null)
                    {
                        this.MessagePresenter.Show("Data tidak ditemukan");
                    }
                    else
                    {
                        AppViewModel.Meeting = Meetingin;
                        this.NavigationService.Navigate <MeetingDetailViewModel>(new NavigationParameter());
                    }
                }
            }

            catch (Exception ex)
            {
                this.MessagePresenter.Show(ex.Message);
            }
        }
Exemplo n.º 5
0
        public void TestConnection_WhenCalled_ShouldCallProxyGetAuthToken()
        {
            // Arrange
            var stubProxy   = GetServiceProxy();
            var credentials = new Credentials();
            var repo        = new RestRepository(_userToken, credentials, stubProxy);
            var header      = new Header();
            var session     = new Session();

            // Act
            var dontCare = repo.TestConnection(session);

            // Assert
            stubProxy.Received().GetAuthToken(Arg.Any <Session>());
        }
        public async void ExecutePhoneVisitor(object parameter)
        {
            try
            {
                this.ActivityPresenter.Show("Loading...", ActivityStyle.SmallIndicatorWithText);
                AppViewModel.Meeting.Visitors.Clear();
                if (string.IsNullOrEmpty(this.SearchPhone))
                {
                    this.MessagePresenter.Show("Masukan nomor handphone");
                }
                else
                {
                    this.Visitor = await RestRepository.GetVisitorAsync(this.SearchPhone);

                    if (string.IsNullOrEmpty(this.Visitor.Name))
                    {
                        this.NavigationService.Navigate <RegisterViewModel>(new NavigationParameter());
                        this.Visitor.VisitorID = Guid.NewGuid();
                        this.Visitor.Phone     = this.SearchPhone;

                        AppViewModel.Meeting.Visitors.Add(this.Visitor);
                    }
                    else
                    {
                        this.NavigationService.Navigate <PurposeViewModel>(new NavigationParameter());
                        AppViewModel.Meeting.Visitors.Add(this.Visitor);
                        AppViewModel.Meeting.NameVisitor = this.Visitor.Name;
                    }
                }
            }
            catch (Exception ex)
            {
                this.ToastPresenter.Show(ex.Message);
            }
            this.ActivityPresenter.Hide();
        }
Exemplo n.º 7
0
 public IndexModel(ILogger <IndexModel> logger, RestRepository restRepository)
 {
     _logger         = logger;
     _restRepository = restRepository;
 }
Exemplo n.º 8
0
 public InquiryBehavior(Application app, string userToken)
 {
     _app            = app;
     _userToken      = userToken;
     _restRepository = new RestRepository(userToken);
 }
Exemplo n.º 9
0
 private static RestRepository InitializeSut()
 {
     var jsonSerializer = new JsonContractSerializer();
     var sut = new RestRepository(jsonSerializer);
     return sut;
 }
Exemplo n.º 10
0
 public static void UseRest() =>
 Repository = new RestRepository();
Exemplo n.º 11
0
 public TestConnectionBehavior(string userToken)
 {
     _userToken      = userToken;
     _restRepository = new RestRepository(userToken);
 }
Exemplo n.º 12
0
 private static void UseRest() =>
 Repository = new RestRepository();