public async Task Test_DownloadError_Error2 ()
		{
			Console.WriteLine ("Test_DownloadError_Error2");

			var bus = new InProcessBus ();
			var repo = new DownloadRepositoryMock ();
			var manager = new DownloadManager.iOS.DownloadManager (bus, repo, 3);
			var wait1 = new AutoResetEvent (false);

			ErrorEnum error = ErrorEnum.Empty;
			bus.Subscribe<DownloadError> (p => {
				error = p.Error;
				wait1.Set();
			});

			manager.TaskError (new TaskError {
				Id = 0,
				Error = TaskErrorEnum.InvalidResponse,
			});

			wait1.WaitOne ();

			Assert.AreEqual (ErrorEnum.TaskError_IdentifierNotFound, error);

		}
Esempio n. 2
0
        public async Task Test_DownloadError_Error3()
        {
            Console.WriteLine("Test_DownloadError_Error3");

            var bus     = new InProcessBus();
            var repo    = new DownloadRepositoryMock();
            var manager = new DownloadManager.iOS.DownloadManager(bus, repo, 3);
            var wait1   = new AutoResetEvent(false);

            ErrorEnum error = ErrorEnum.Empty;

            bus.Subscribe <DownloadError> (p => {
                error = p.Error;
                wait1.Set();
            });

            var download = new Download {
                Url = "url", State = State.Finished
            };

            repo.Insert(download);
            manager.TaskError(new TaskError {
                Id    = download.Id,
                Error = TaskErrorEnum.DownloadError,
            });

            wait1.WaitOne();
            Assert.AreEqual(ErrorEnum.TaskError_InvalidState, error);
        }
Esempio n. 3
0
        public async Task Test_DownloadError_Error2()
        {
            Console.WriteLine("Test_DownloadError_Error2");

            var bus     = new InProcessBus();
            var repo    = new DownloadRepositoryMock();
            var manager = new DownloadManager.iOS.DownloadManager(bus, repo, 3);
            var wait1   = new AutoResetEvent(false);

            ErrorEnum error = ErrorEnum.Empty;

            bus.Subscribe <DownloadError> (p => {
                error = p.Error;
                wait1.Set();
            });

            manager.TaskError(new TaskError {
                Id    = 0,
                Error = TaskErrorEnum.InvalidResponse,
            });

            wait1.WaitOne();

            Assert.AreEqual(ErrorEnum.TaskError_IdentifierNotFound, error);
        }
Esempio n. 4
0
        public async Task Test_DownloadError_Error500()
        {
            Console.WriteLine("Test_DownloadError_Error500");

            var bus     = new InProcessBus();
            var repo    = new DownloadRepositoryMock();
            var manager = new DownloadManager.iOS.DownloadManager(bus, repo, 3);
            var wait1   = new AutoResetEvent(false);

            ErrorEnum error = ErrorEnum.Empty;

            bus.Subscribe <DownloadError> (p => {
                error = p.Error;
                wait1.Set();
            });

            var download = new Download {
                Url = "url", State = State.Downloading
            };

            repo.Insert(download);

            manager.TaskError(new TaskError {
                Id         = download.Id,
                Error      = TaskErrorEnum.InvalidResponse,
                StatusCode = 500
            });

            Assert.AreEqual(State.Error, download.State);
            Assert.AreEqual(500, download.StatusCode);
        }
		public async Task Test_DownloadError_Error3 ()
		{

			Console.WriteLine ("Test_DownloadError_Error3");

			var bus = new InProcessBus ();
			var repo = new DownloadRepositoryMock ();
			var manager = new DownloadManager.iOS.DownloadManager (bus, repo, 3);
			var wait1 = new AutoResetEvent (false);

			ErrorEnum error = ErrorEnum.Empty;
			bus.Subscribe<DownloadError> (p => {
				error = p.Error;
				wait1.Set();
			});

			var download = new Download { Url = "url", State = State.Finished };
			repo.Insert (download);
			manager.TaskError (new TaskError {
				Id = download.Id,
				Error = TaskErrorEnum.DownloadError,
			});

			wait1.WaitOne ();
			Assert.AreEqual (ErrorEnum.TaskError_InvalidState, error);

		}
		public async Task Test_DownloadError_Error500 ()
		{

			Console.WriteLine ("Test_DownloadError_Error500");

			var bus = new InProcessBus ();
			var repo = new DownloadRepositoryMock ();
			var manager = new DownloadManager.iOS.DownloadManager (bus, repo, 3);
			var wait1 = new AutoResetEvent (false);

			ErrorEnum error = ErrorEnum.Empty;
			bus.Subscribe<DownloadError> (p => {
				error = p.Error;
				wait1.Set();
			});

			var download = new Download { Url = "url", State = State.Downloading };
			repo.Insert (download);

			manager.TaskError (new TaskError {
				Id = download.Id,
				Error = TaskErrorEnum.InvalidResponse,
				StatusCode = 500
			});

			Assert.AreEqual (State.Error, download.State);
			Assert.AreEqual (500, download.StatusCode);

		}