Exemple #1
0
        public void TestMinGreaterThanMaxException()
        {
            var randomOrg = new RandomOrgV1();

            Assert.ThrowsException <RandoOrgMinGreaterThanMaxException>(() => randomOrg.IntegerRequest(6, 1));
            Assert.ThrowsException <RandoOrgMinGreaterThanMaxException>(() => randomOrg.IntegerRequest(-60, -100));
        }
Exemple #2
0
        public async Task <string> CallRequestAsync()
        {
            var randomOrg = new RandomOrgV1();

            var result = await randomOrg.IntegerRequest(1, 100).Request();

            return(result);
        }
Exemple #3
0
        private async void appBarButton_Click(object sender, EventArgs e)
        {
            try
            {
                RandomOrgV1 randomOrg = new RandomOrgV1();

                txtResult.Text = await randomOrg.IntegerRequest(Int32.Parse(txtMin.Text), Int32.Parse(txtMax.Text)).Request();
            }
            catch (RandoOrgMinGreaterThanMaxException exception)
            {
                txtResult.Text = exception.Message;
            }
            catch (Exception exception)
            {
                txtResult.Text = exception.Message;
            }
        }
Exemple #4
0
        public void TestFluentIntegersAddress()
        {
            var randomOrg = new RandomOrgV1();

            Assert.AreEqual("http://random.org/integers?num=1&min=1&max=100&col=1&base=10&format=plain&rnd=new", randomOrg.IntegerRequest(1, 100).RequestAddress.AbsoluteUri);
        }