public void TestMinGreaterThanMaxException() { var randomOrg = new RandomOrgV1(); Assert.ThrowsException <RandoOrgMinGreaterThanMaxException>(() => randomOrg.IntegerRequest(6, 1)); Assert.ThrowsException <RandoOrgMinGreaterThanMaxException>(() => randomOrg.IntegerRequest(-60, -100)); }
public async Task <string> CallRequestAsync() { var randomOrg = new RandomOrgV1(); var result = await randomOrg.IntegerRequest(1, 100).Request(); return(result); }
public void TestFormatQueryString() { var randomOrg = new RandomOrgV1(); Assert.AreEqual("http://random.org/?num=1&min=1&max=6&col=1&base=10&format=plain&rnd=new", randomOrg.FormatQueryString(1, 6).AbsoluteUri); Assert.AreEqual("http://random.org/?num=1&min=1&max=60&col=1&base=10&format=plain&rnd=new", randomOrg.FormatQueryString(1, 60).AbsoluteUri); Assert.AreEqual("http://random.org/?num=1&min=10&max=60&col=1&base=10&format=plain&rnd=new", randomOrg.FormatQueryString(10, 60).AbsoluteUri); Assert.AreEqual("http://random.org/?num=1&min=-100&max=-60&col=1&base=10&format=plain&rnd=new", randomOrg.FormatQueryString(-100, -60).AbsoluteUri); }
public void TestFormatBase() { var randomOrg = new RandomOrgV1(); Assert.AreEqual("base2", randomOrg.FormatBase(NumericSystemEnum.Binary)); Assert.AreEqual("base8", randomOrg.FormatBase(NumericSystemEnum.Octal)); Assert.AreEqual("base10", randomOrg.FormatBase(NumericSystemEnum.Decimal)); Assert.AreEqual("base16", randomOrg.FormatBase(NumericSystemEnum.Hexa)); }
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; } }
public void TestStripResult() { var randomOrg = new RandomOrgV1(); Assert.AreEqual("result", randomOrg.StripResult("result\r\n")); }
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); }
public void TestRequestAddressShouldNotBeNull() { var randomOrg = new RandomOrgV1(); Assert.IsNotNull(randomOrg.RequestAddress); }