Beispiel #1
0
        public void PublishAndUnpublishTest()
        {
            long layoutId = VirtualLayoutCopierTests.GetFirstlayoutId();

            //   layoutId = 56295660000000;
            if (layoutId > 0)
            {
                var  container = StructureMapContainerInit();
                long copiedId  = VirtualLayoutCopier.CreateLayoutCopyInAvrService(layoutId, "ru", container);

                SharedModel model;
                using (PresenterFactory.BeginSharedPresenterTransaction(container, new EmptyPostableForm()))
                {
                    model = PresenterFactory.SharedPresenter.SharedModel;
                }
                using (var dbService = new WinLayout_DB(model))
                {
                    long publishedId;

                    using (new StopwathTransaction("++ Publish layout " + copiedId))
                    {
                        publishedId = dbService.PublishUnpublish(copiedId, true);
                    }
                    Assert.AreEqual(1, GetLayoutCount(publishedId));

                    using (new StopwathTransaction("++ UnPublish layout " + publishedId))
                    {
                        dbService.PublishUnpublish(copiedId, false);
                    }
                    Assert.AreEqual(0, GetLayoutCount(publishedId));
                }
            }
        }
Beispiel #2
0
        public void AvrServiceCopyLayoutTest()
        {
            long id = VirtualLayoutCopierTests.GetFirstlayoutId();

            if (id > 0)
            {
                var tasks = new List <Action>();
                // todo [ivan] change VirtualLayoutCopier to use different connections and test multithread
                for (int i = 0; i < 1; i++)
                {
                    var copyTask = new Action(() =>
                    {
                        //Assert.IsTrue(false);
                        AvrServiceCopyLayoutResult result = ServiceClientHelper.AvrServiceCopyLayout(id);
                        Assert.IsNotNull(result);
                        Assert.IsTrue(result.IsOk, result.ErrorMessage);
                        Assert.IsTrue(result.Model > 0);
                    });
                    tasks.Add(copyTask);
                }
                Parallel.Invoke(new ParallelOptions {
                    MaxDegreeOfParallelism = 2
                }, tasks.ToArray());
            }
        }