Ejemplo n.º 1
0
        public void Promotion()
        {
            session.DeleteEach <Promotion>();
            var fixture = new LocalPromotion("assets/Валемидин.JPG");

            Fixture(fixture);

            StartWait();
            Click("ShowCatalog");
            OpenOffers(fixture.Promotion.Catalogs[0]);
            AdvanceScheduler(500);
            dispatcher.Invoke(() => {
                var promotions = activeWindow.Descendants <PromotionPopup>().First();
                Assert.IsTrue(promotions.IsVisible);
                Assert.That(promotions.AsText(), Does.Contain(fixture.Promotion.Annotation));
                var presenter = promotions.Descendants <ContentPresenter>()
                                .First(c => c.DataContext is Promotion && ((Promotion)c.DataContext).Id == fixture.Promotion.Id);
                var link = presenter.Descendants <TextBlock>().SelectMany(b => b.Inlines).OfType <Hyperlink>().First();
                dispatcher.BeginInvoke(new Action(() => InternalClick(link)));
            });

            WaitWindow(fixture.Promotion.DisplayName);
            dispatcher.Invoke(() => {
                var viewer = activeWindow.Descendants <FlowDocumentScrollViewer>().First();
                var image  = viewer.Document.Descendants <Image>().First();
                Assert.IsNotNull(image);
                Assert.That(image.Source.Height, Is.GreaterThan(0));
            });
        }
        public void Load_promotion()
        {
            var fixture = new LocalPromotion {
                Catalog = catalog
            };

            Fixture(fixture);
            Assert.That(model.Offers.Value.Count, Is.GreaterThan(0));
            scheduler.AdvanceByMs(500);
            catalog = fixture.Promotion.Catalogs.First();
            Assert.That(model.Promotions.Promotions.Value.Count, Is.GreaterThan(0));
        }