public void AsString1_Always_ReturnsFallback() { // Arrange IJsonObject json = JsonObject.OfNull(); // Act // Assert Assert.That(json.AsString("foo"), Is.EqualTo("foo")); }
public void AsString1_ReturnsFallbackValue() { // Arrange IJsonObject json0 = JsonObject.Of(true); IJsonObject json1 = JsonObject.Of(false); // Act // Assert Assert.That(json0.AsString("foo"), Is.EqualTo("foo")); Assert.That(json1.AsString("bar"), Is.EqualTo("bar")); }
public void AsString1_IgnoresFallbackValues() { // Arrange IJsonObject json0 = JsonObject.Of(string.Empty); IJsonObject json1 = JsonObject.Of("abc"); // Act // Assert Assert.That(json0.AsString("foo"), Is.EqualTo(string.Empty)); Assert.That(json1.AsString("bar"), Is.EqualTo("abc")); }
public void AsString_ReturnsValue() { // Arrange IJsonObject json0 = JsonObject.Of(string.Empty); IJsonObject json1 = JsonObject.Of("abc"); // Act // Assert Assert.That(json0.AsString(), Is.EqualTo(string.Empty)); Assert.That(json1.AsString(), Is.EqualTo("abc")); }
public void AsString1_ReturnsFallback() { // Arrange IJsonObject json0 = JsonObject.Of(new bool[0]); IJsonObject json1 = JsonObject.Of("abc", "def"); // Act // Assert Assert.That(json0.AsString("foo"), Is.EqualTo("foo")); Assert.That(json1.AsString("bar"), Is.EqualTo("bar")); }
public void AsString_ThrowsException() { // Arrange IJsonObject json0 = JsonObject.Of(new bool[0]); IJsonObject json1 = JsonObject.Of("abc", "def"); // Act // Assert Assert.Throws <ApplicationException>(() => json0.AsString()); Assert.Throws <ApplicationException>(() => json1.AsString()); }
public void AsString1_ReturnsFallbackValues() { // Arrange IJsonObject json0 = JsonObject.FromString("{}"); IJsonObject json1 = JsonObject.FromString("{a:'abc',b:123,c:true,d:null,e:[],f:{}}"); // Act // Assert Assert.That(json0.AsString("foo"), Is.EqualTo("foo")); Assert.That(json1.AsString("bar"), Is.EqualTo("bar")); }
public void AsString_ThrowsException() { // Arrange IJsonObject json0 = JsonObject.FromString("{}"); IJsonObject json1 = JsonObject.FromString("{a:'abc',b:123,c:true,d:null,e:[],f:{}}"); // Act // Assert Assert.Throws <ApplicationException>(() => json0.AsString()); Assert.Throws <ApplicationException>(() => json1.AsString()); }
public void AsString_Always_ThrowsException() { // Arrange IJsonObject json = JsonObject.OfNull(); // Act // Assert Assert.Throws <ApplicationException>(() => { json.AsString(); }); }
public void AsString_ThrowsException() { // Arrange IJsonObject json0 = JsonObject.Of(true); IJsonObject json1 = JsonObject.Of(true); // Act // Assert Assert.Throws <ApplicationException>(() => { json0.AsString(); }); Assert.Throws <ApplicationException>(() => { json1.AsString(); }); }