public void WhenNameValuesIsEmpty_ThenReturnEqual() { var sut = new Uri("http://localhost/myapp?q1=1&q2=2"); var result = sut.AddOrUpdateQueryParams(new Dictionary <string, string>()); Assert.That(result, Is.EqualTo(sut)); Assert.That(result, Is.Not.SameAs(sut)); }
public void WhenNameValuesHasItems_ThenUpdateQuery() { var sut = new Uri("http://localhost/myapp?q1=1&q2=2"); var result = sut.AddOrUpdateQueryParams(new Dictionary <string, string>() { { "q2", "3" }, { "q3", "10" } }); Assert.That(result, Is.EqualTo(new Uri("http://localhost/myapp?q1=1&q2=3&q3=10"))); Assert.That(result, Is.Not.SameAs(sut)); }
public void WhenNameValuesIsNull_ThenThrowException() { var sut = new Uri("http://localhost/myapp"); Assert.Throws <ArgumentNullException>(() => sut.AddOrUpdateQueryParams(null as IDictionary <string, string>)); }