Exemplo n.º 1
0
        public async Task CheckForUpdateTest(UpdateTrack updateTrack, string urlDiff)
        {
            // Enable Distribute for debuggable builds.
            DistributeEvent?.Invoke(this, DistributeTestType.EnableDebuggableBuilds);

            // Setup network adapter.
            var httpNetworkAdapter = new HttpNetworkAdapter();

            DependencyConfiguration.HttpNetworkAdapter = httpNetworkAdapter;
            var implicitCheckForUpdateTask = httpNetworkAdapter.MockRequest(request => request.Method == "GET" && request.Uri.Contains(urlDiff));
            var startServiceTask           = httpNetworkAdapter.MockRequestByLogType("startService");

            // Start AppCenter.
            AppCenter.UnsetInstance();
            AppCenter.LogLevel     = LogLevel.Verbose;
            Distribute.UpdateTrack = updateTrack;

            // Save update token.
            if (updateTrack == UpdateTrack.Private)
            {
                DistributeEvent?.Invoke(this, DistributeTestType.SaveMockUpdateToken);
            }
            AppCenter.Start(Config.ResolveAppSecret(), typeof(Distribute));

            // Wait for "startService" log to be sent.
            await startServiceTask;

            DistributeEvent?.Invoke(this, DistributeTestType.OnResumeActivity);

            // Wait when Distribute will start.
            await Distribute.IsEnabledAsync();

            // Wait for processing event.
            var resultImplicit = await implicitCheckForUpdateTask;

            // Verify response.
            Assert.Equal("GET", resultImplicit.Method);
            Assert.Contains(urlDiff, resultImplicit.Uri);
            Assert.Contains(Config.ResolveAppSecret(), resultImplicit.Uri);

            // Wait a 5s for give time to complete internal processes
            // to avoid this case `A check for update is already ongoing.`
            await Task.Delay(5000);

            // Check for update.
            var explicitCheckForUpdateTask = httpNetworkAdapter.MockRequest(request => request.Method == "GET" && request.Uri.Contains(urlDiff));

            Distribute.CheckForUpdate();

            // Wait for processing event.
            var resultExplicit = await explicitCheckForUpdateTask;

            // Verify response.
            Assert.Equal("GET", resultExplicit.Method);
            Assert.Contains(urlDiff, resultExplicit.Uri);
            Assert.Contains(Config.ResolveAppSecret(), resultExplicit.Uri);
        }
Exemplo n.º 2
0
        public async Task CheckForUpdateTest(UpdateTrack updateTrack, string urlDiff)
        {
            // Enable Distribute for debuggable builds.
            DistributeEvent?.Invoke(this, DistributeTestType.EnableDebuggableBuilds);

            // Setup network adapter.
            var httpNetworkAdapter = new HttpNetworkAdapter();

            DependencyConfiguration.HttpNetworkAdapter = httpNetworkAdapter;
            HttpResponse response = new HttpResponse()
            {
                Content    = GetReleaseJson("30", "3.0.0", false, 19),
                StatusCode = 200
            };
            var implicitCheckForUpdateTask = httpNetworkAdapter.MockRequest(request => request.Method == "GET");
            var explicitCheckForUpdateTask = httpNetworkAdapter.MockRequest(request => request.Method == "GET", response);
            var startServiceTask           = httpNetworkAdapter.MockRequestByLogType("startService");

            // Start AppCenter.
            AppCenter.UnsetInstance();
            AppCenter.LogLevel     = LogLevel.Verbose;
            Distribute.UpdateTrack = updateTrack;

            // Save update token.
            if (updateTrack == UpdateTrack.Private)
            {
                DistributeEvent?.Invoke(this, DistributeTestType.SaveMockUpdateToken);
            }
            AppCenter.Start(Config.ResolveAppSecret(), typeof(Distribute));

            // Wait for "startService" log to be sent.
            await startServiceTask;

            DistributeEvent?.Invoke(this, DistributeTestType.OnResumeActivity);

            // Wait when Distribute will start.
            await Distribute.IsEnabledAsync();

            // Wait for processing event.
            var result = await implicitCheckForUpdateTask;

            // Verify response.
            Assert.Equal("GET", result.Method);
            Assert.True(result.Uri.Contains(urlDiff));
            Assert.True(result.Uri.Contains(Config.ResolveAppSecret()));

            // Check for update.
            Distribute.CheckForUpdate();

            // Wait for processing event.
            result = await explicitCheckForUpdateTask;

            // Verify response.
            Assert.Equal("GET", result.Method);
            Assert.True(result.Uri.Contains(urlDiff));
            Assert.True(result.Uri.Contains(Config.ResolveAppSecret()));
        }
Exemplo n.º 3
0
        public MainForm()
        {
            InitializeComponent();

            chaptersDGV.DataSource          = _chapterListBindingSource;
            chaptersDGV.AutoGenerateColumns = false;
            // Copy default cell styles
            _defaultCellStyleA = chaptersDGV.DefaultCellStyle;
            _defaultCellStyleB = chaptersDGV.AlternatingRowsDefaultCellStyle;

            comboBoxNewChapterName.SelectedIndex = 0;

            UpdateTrackDelegate       = UpdateTrackMethod;
            UpdateChapterListDelegate = UpdateFirstColumn;
            SetCurrentChapterDelegate = SetCurrentChapterMethod;
        }
Exemplo n.º 4
0
 static void SetUpdateTrack(UpdateTrack updateTrack)
 {
     AndroidDistribute.UpdateTrack = (int)updateTrack;
 }
Exemplo n.º 5
0
        static void SetUpdateTrack(UpdateTrack updateTrack)
        {
            var updateTrackValue = (int)updateTrack;

            iOSDistribute.SetUpdateTrack((MSACUpdateTrack)updateTrackValue);
        }
Exemplo n.º 6
0
 static void SetUpdateTrack(UpdateTrack updateTrack)
 {
 }
Exemplo n.º 7
0
 public static int ToPickerUpdateTrackIndex(UpdateTrack updateTrack)
 {
     return((int)(updateTrack - 1));
 }
Exemplo n.º 8
0
 public static async System.Threading.Tasks.Task SetPersistedUpdateTrackAsync(UpdateTrack choice)
 {
     Application.Current.Properties[Constants.UpdateTrackKey] = choice.ToString();
     await Application.Current.SavePropertiesAsync();
 }
Exemplo n.º 9
0
        public object Put(UpdateTrack request)
        {
            var entity = request.ConvertTo <Track>();

            return(new CommonResponse(logic.Update(entity)));
        }