コード例 #1
0
ファイル: TestFixture.cs プロジェクト: Kosta-kok/Xsolla-test
        public async void testSetPeriods()
        {
            Console.WriteLine("------testSetPeriods");
            try
            {
                int id = await ApiClass.CreatePromotion();

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

                NewPeriods etalon   = TestHelper.BasePeriods();
                string     Response = await ApiClass.SetPeriods(id, etalon);

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

                Periods ResSub = await ApiClass.GetPeriodsPromotion(id);

                NewPeriods actual = ResSub as NewPeriods;
                Assert.AreEqual(etalon, actual, Messages.msg_objects_not_equal);
                Console.WriteLine(Messages.msg_objects_equal);
                Console.WriteLine(Messages.msg_test_pass);
            }
            catch (Exception e)
            {
                Console.WriteLine(Messages.msg_test_fail);
            }
        }
コード例 #2
0
ファイル: TestHelper.cs プロジェクト: Kosta-kok/Xsolla-test
        public static NewPeriods BasePeriods()
        {
            var periods = new NewPeriods();

            periods.periods.Add(new Period
            {
                from = "2019-01-20T00:00:00+05:00",
                to   = "2019-02-20T00:00:00+05:00"
            });
            periods.periods.Add(new Period
            {
                from = "2018-03-05T00:00:00+05:00",
                to   = "2018-09-05T00:00:00+05:00"
            });
            return(periods);
        }
コード例 #3
0
        public static async Task <string> SetPeriods(int promotionId, NewPeriods periods)
        {
            string json = JsonConvert.SerializeObject(periods);

            return(await SetConverter(String.Format(Resources.periods, promotionId), json));
        }