Example #1
0
        private static void FirstIndexerRunner()
        {
            NewSubject.WriteLine(nameof(Indexer1 <string>));

            var count = 0;
            var myStringCollection = new Indexer1 <string>();

            myStringCollection[count++] = $"My Test {count}";
            myStringCollection[count++] = $"My Test {count}";

            for (int i = 0; i < count; i++)
            {
                Console.WriteLine($"myStringCollection {i}: {myStringCollection[i]}");
            }
        }
Example #2
0
        private static void SecondIndexerRunner()
        {
            NewSubject.WriteLine(nameof(Indexer2 <string>));

            var count = 0;
            var myStringCollection = new Indexer2 <string>();

            myStringCollection.Add($"My Test {++count}");
            myStringCollection.Add($"My Test {++count}");

            for (int i = 0; i < count; i++)
            {
                Console.WriteLine($"myStringCollection {i}: {myStringCollection[i]}");
            }
        }
Example #3
0
        public static NewSubject BaseSubject2()
        {
            NewSubject subject = new NewSubject();

            subject.purchase = false;

            /*subject.items.Add(new Sku
             * {
             *  sku = "t-43-3-unique-id"
             * });*/
            float pack = float.Parse(Properties.Resources.packages);

            subject.packages.Add(pack);
            //subject.digital_contents.Add( BaseDigitalContents());////в документации нет описания объекта Drm и самого digital_contents.
            return(subject);
        }
 private void Edit()
 {
     if (Index >= 0)
     {
         var subject = ClassSubject[Index];
         var context = new SubjectVM(subject, departments.ToArray());
         var wins    = new NewSubject()
         {
             DataContext = context
         };
         wins.ShowDialog();
         if (context.Subject != null)
         {
             ClassSubject[Index] = context.Subject;
         }
     }
 }
Example #5
0
        public async void testSetSubject()
        {
            Console.WriteLine("------testSetSubject");
            try
            {
                int id = await ApiClass.CreatePromotion();

                //id = -1;
                Assert.False(id == -1, Messages.msg_object_not_created);
                Console.WriteLine(Messages.msg_object_created);

                NewSubject etalon        = TestHelper.BaseSubject();
                string     ResSetSubject = await ApiClass.SetSubject(id, etalon);

                if (ResSetSubject != "")
                {
                    Console.WriteLine(ResSetSubject);
                }
                Assert.IsNullOrEmpty(ResSetSubject, Messages.msg_object_not_created);
                Console.WriteLine(Messages.msg_object_created);

                //Subject ResGetSubject= await ApiClass.GetSubjectPromotion(id);

                etalon        = TestHelper.BaseSubject2();
                ResSetSubject = await ApiClass.SetSubject(id, etalon);

                if (ResSetSubject != "")
                {
                    Console.WriteLine(ResSetSubject);
                }
                Assert.IsNullOrEmpty(ResSetSubject, Messages.msg_object_not_created);
                Console.WriteLine(Messages.msg_object_created);

                //ResGetSubject = await ApiClass.GetSubjectPromotion(id);

                Console.WriteLine(Messages.msg_test_pass);
            }
            catch (Exception e)
            {
                Console.WriteLine(Messages.msg_test_fail);
            }
        }
Example #6
0
        private void Add()
        {
            var context = new SubjectVM(departments.ToArray());
            var wind    = new NewSubject()
            {
                DataContext = context
            };

            wind.ShowDialog();
            if (wind.DialogResult == true)
            {
                if (context.Subject != null)
                {
                    if (RequestToDataBase.Instance.requestInsertIntoSubject(context.Subject))
                    {
                        ClassSubject.Add(context.Subject);
                    }
                }
            }
        }
Example #7
0
 private void Edit()
 {
     if (Index >= 0)
     {
         var subject = ClassSubject[Index];
         var context = new SubjectVM(subject, departments.ToArray());
         var wind    = new NewSubject()
         {
             DataContext = context
         };
         wind.ShowDialog();
         if (wind.DialogResult == true)
         {
             if (context.Subject != null)
             {
                 if (RequestToDataBase.Instance.requestUpdateSubject(context.Subject, ClassSubject, Index))
                 {
                     ClassSubject[Index] = context.Subject;
                 }
             }
         }
     }
 }
Example #8
0
        public static void Run()
        {
            Console.WriteLine();
            Delegate1.Del handler = SubscribeDelegate1.DelegateMethod;

            handler += SubscribeDelegate1.DelegateMethod;
            handler += SubscribeDelegate1.DelegateMethod2;

            handler("First Delegate Test.");

            NewSubject.WriteLine("Delegate as a parameters - Name: Callback");

            IMyPrint myPrint1 = new MyPrint1();

            SubscribeDelegate1.MethodWithCallback(1, 2, handler, myPrint1);

            NewSubject.WriteLine("Delegate as a parameters - Name: Callback 2");

            handler -= SubscribeDelegate1.DelegateMethod2;

            IMyPrint myPrint2 = new MyPrint2();

            SubscribeDelegate1.MethodWithCallback(3, 5, handler, myPrint2);
        }
Example #9
0
            public void Scenario(
                Subject instance,
                dddlib.Persistence.EventDispatcher.Sdk.EventDispatcher eventDispatcher,
                NewSubject newSubject,
                AutoResetEvent notify)
            {
                "Given a SQL Server event dispatcher"
                .f(c =>
                {
                    notify          = new AutoResetEvent(false);
                    eventDispatcher = new SqlServer.SqlServerEventDispatcher(
                        this.ConnectionString,
                        (sequenceNumber, @event) =>
                    {
                        newSubject = @event as NewSubject;
                        notify.Set();
                    },
                        Guid.NewGuid()).Using(c);
                });

                "And an instance of an aggregate root"
                .f(() => instance = new Subject("key"));

                "When that instance is saved to the repository"
                .f(() => this.repository.Save(instance));

                "And a short period of time elapses"
                .f(() => notify.WaitOne(10 * 1000) /* up to 10 secs */);

                "Then the event is dispatched"
                .f(() =>
                {
                    newSubject.Should().NotBeNull();
                    newSubject.Id.Should().Be(instance.Id);
                });
            }
Example #10
0
 private void Handle(NewSubject @event)
 {
     this.NaturalKey = @event.NaturalKey;
 }
Example #11
0
 private static void CovarianceFruitsRunner()
 {
     NewSubject.WriteLine("Covariance with fruits");
     ShowFruit.Run();
 }
Example #12
0
 private void Handle(NewSubject @event)
 {
     this.Id = @event.Id;
 }
Example #13
0
 private static void Delegater1Runner()
 {
     NewSubject.WriteLine(nameof(Delegate1));
     Delegate1Caller.Run();
 }
Example #14
0
 private static void ContravarianceRunner()
 {
     NewSubject.WriteLine(nameof(Contravariance));
     Contravariance.Run();
 }
 private void Handle(NewSubject @event)
 {
     this.Id = Map.Event(@event).ToValueObject <SubjectId>();
 }
 private void Handle(NewSubject @event)
 {
     this.NaturalKey = Map.Event(@event).ToValueObject <NaturalKey>();
 }
Example #17
0
 private static void StructVsClassRunner()
 {
     NewSubject.WriteLine("Struct Vs Class");
     StructVsClass.Run();
 }
Example #18
0
 private static void BaseCovarianceRunner()
 {
     NewSubject.WriteLine("Base Covariance");
     Covariance.Run();
 }
Example #19
0
        public static async Task <string> SetSubject(int promotionId, NewSubject subject)
        {
            string json = JsonConvert.SerializeObject(subject);

            return(await SetConverter(String.Format(Resources.subject, promotionId), json));
        }
 private void Handle(NewSubject @event)
 {
     this.Thing = Map.Event(@event).ToEntity <Thing>();
 }
Example #21
0
 private static void GoogleWebSiteMenu()
 {
     NewSubject.WriteLine("Web Site");
     CallWebSite.Run();
 }
Example #22
0
        public async void testTogglePromotionPositive()
        {
            //негативный тест, заранее знаем что переключаль не сработает из за не полных данных акции
            Console.WriteLine("------testTooglePromotionPositive");
            try
            {
                int id = await ApiClass.CreatePromotion();

                //id = -1;
                Assert.False(id == -1, Messages.msg_object_not_created);
                Console.WriteLine(Messages.msg_object_created);

                //зададим предмет акции
                NewSubject etalon        = TestHelper.BaseSubject2();
                string     ResSetSubject = await ApiClass.SetSubject(id, etalon);

                if (ResSetSubject != "")
                {
                    Console.WriteLine(ResSetSubject);
                }
                Assert.IsNullOrEmpty(ResSetSubject, Messages.msg_object_not_created);
                Console.WriteLine(Messages.msg_object_created);


                //зададим период действия акции
                string ResSetPeriod = await ApiClass.SetPeriods(id, TestHelper.BasePeriods());

                if (ResSetPeriod != "")
                {
                    Console.WriteLine(ResSetPeriod);
                }
                Assert.IsNullOrEmpty(ResSetPeriod, Messages.msg_object_not_created);
                Console.WriteLine(Messages.msg_object_created);
                //зададим вознаграждения
                NewRewards etalonReward = TestHelper.BaseRewards();
                string     ResSetRew    = await ApiClass.SetRewards(id, etalonReward);

                if (ResSetRew != "")
                {
                    Console.WriteLine(ResSetRew);
                }
                Assert.IsNullOrEmpty(ResSetRew, Messages.msg_object_not_created);
                Console.WriteLine(Messages.msg_object_created);
                //проверим готовность акции к активации
                List <Review> ResReview = await ApiClass.GetReviewPromotion(id);

                Assert.False(ResReview.Count != 0, Messages.msg_promotion_valid);

                Promotion ResEtalon = await ApiClass.GetPromotion(id);

                bool etalonEnable = ResEtalon.enabled;

                string Response = await ApiClass.TogglePromotion(id);

                if (Response != "")
                {
                    Console.WriteLine(Response);
                }
                Assert.IsNullOrEmpty(Response, Messages.msg_not_toggle);
                Promotion ResActual = await ApiClass.GetPromotion(id);

                bool actualEnable = ResActual.enabled;
                Assert.False(etalonEnable == actualEnable, Messages.msg_promotion_not_enable);
                Console.WriteLine(Messages.msg_promotion_enable);
                Console.WriteLine(Messages.msg_test_pass);
            }
            catch (Exception e)
            {
                Console.WriteLine(Messages.msg_test_fail);
            }
        }
Example #23
0
 private static void TeaTimeMenu()
 {
     NewSubject.WriteLine("Tea Time");
     TeaTime1.Run();
 }