Example #1
0
        public async Task CompanionFail()
        {
            controller.StartTimeout = TimeSpan.FromSeconds(2);
            OnActivate = () => { throw new NotImplementedException(); };
            GetPlayer  = () => new Mockups.Vpaid();

            var adSource = new Mockups.AdSource()
            {
                Type = Guid.NewGuid().ToString()
            };
            var cancellationToken = new CancellationToken();
            var progress          = new Progress <AdStatus>();

            await UnitTestExtensions.ThrowsExceptionAsync <Exception>(async() => await controller.PlayAdAsync(adSource).AsTask(cancellationToken, progress));

            Assert.IsFalse(playerStack.Any());
            Assert.IsTrue(state == AdState.None);
        }
        public async Task CompanionFail()
        {
            controller.StartTimeout = TimeSpan.FromSeconds(2);
            OnActivate = () => { throw new NotImplementedException(); };
            GetPlayer = () => new Mockups.Vpaid();

            var adSource = new Mockups.AdSource() { Type = Guid.NewGuid().ToString() };
            var cancellationToken = new CancellationToken();
            var progress = new Progress<AdStatus>();

            await UnitTestExtensions.ThrowsExceptionAsync<Exception>(async () => await controller.PlayAdAsync(adSource).AsTask(cancellationToken, progress));
            Assert.IsFalse(playerStack.Any());
            Assert.IsTrue(state == AdState.None);
        }