コード例 #1
0
        public MessageReplyMarkupTestsFixture(TestsFixture testsFixture)
        {
            TestsFixture = testsFixture;

            var privateChatId = ConfigurationProvider.TestConfigurations.TesterPrivateChatId;

            if (privateChatId is null)
            {
                TestsFixture.SendTestCollectionNotificationAsync(
                    Constants.TestCollections.MessageReplyMarkup,
                    "A tester should send /test command in a private chat to begin")
                .Wait();

                TestsFixture.UpdateReceiver.DiscardNewUpdatesAsync().Wait();
                TesterPrivateChatId = TestsFixture.GetChatIdFromTesterAsync(ChatType.Private).Result;
            }
            else
            {
                TesterPrivateChatId = privateChatId;

                TestsFixture.SendTestCollectionNotificationAsync(Constants.TestCollections.MessageReplyMarkup,
                                                                 "All messages for this collection will be sent in private chat")
                .Wait();

                TestsFixture.SendTestCollectionNotificationAsync(Constants.TestCollections.MessageReplyMarkup, chatid: TesterPrivateChatId)
                .Wait();
            }
        }
コード例 #2
0
        public PaymentTestsFixture(TestsFixture testsFixture)
        {
            TestsFixture = testsFixture;

            PaymentProviderToken = ConfigurationProvider.TestConfigurations.PaymentProviderToken;
            if (string.IsNullOrWhiteSpace(PaymentProviderToken))
            {
                throw new ArgumentNullException(nameof(PaymentProviderToken),
                                                "Payment provider token is not provided or is empty.");
            }

            if (PaymentProviderToken.Length < 15)
            {
                throw new ArgumentException("Payment provider token is too short.", nameof(PaymentProviderToken));
            }

            string privateChatId = ConfigurationProvider.TestConfigurations.TesterPrivateChatId;

            if (string.IsNullOrWhiteSpace(privateChatId))
            {
                TestsFixture.SendTestCollectionNotificationAsync(
                    CommonConstants.TestCollections.Payment,
                    "A tester should send /test command in a private chat to begin")
                .Wait();

                TestsFixture.UpdateReceiver.DiscardNewUpdatesAsync().Wait();
                TesterPrivateChatId = TestsFixture.GetChatIdFromTesterAsync(ChatType.Private).Result;
            }
            else
            {
                TesterPrivateChatId = privateChatId;

                TestsFixture.SendTestCollectionNotificationAsync(CommonConstants.TestCollections.Payment,
                                                                 "All messages for this collection will be sent in private chat")
                .Wait();

                TestsFixture.SendTestCollectionNotificationAsync(CommonConstants.TestCollections.Payment, chatid: TesterPrivateChatId)
                .Wait();
            }
        }