-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
188 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ public async Task RunAsync(string userId, IZoomClient client, TextWriter log, Ca | |
//await Task.Delay(500, cancellationToken).ConfigureAwait(false); | ||
|
||
// CREATE NEW USER (commenting out this integration test because I currently do not have permission to create users) | ||
//var newUser = await client.Users.CreateAsync("[email protected]", "ZoomNet", "Integration Testing", UserType.Basic, UserCreateType.Normal, cancellationToken).ConfigureAwait(false); | ||
//var newUser = await client.Users.CreateAsync("[email protected]", "ZoomNet", "Integration Testing", null, UserType.Basic, UserCreateType.Normal, cancellationToken).ConfigureAwait(false); | ||
//await log.WriteLineAsync($"New user created: {newUser.Id}").ConfigureAwait(false); | ||
//await Task.Delay(500, cancellationToken).ConfigureAwait(false); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
using Newtonsoft.Json.Linq; | ||
using Shouldly; | ||
using System; | ||
using Xunit; | ||
|
||
namespace ZoomNet.UnitTests.Utilities | ||
{ | ||
public class InternalTests | ||
{ | ||
[Fact] | ||
public void GetProperty_when_property_is_present_and_throwIfMissing_is_true() | ||
{ | ||
// Arrange | ||
var item = new JObject() | ||
{ | ||
{ "aaa", "123" } | ||
}; | ||
|
||
// Act | ||
var property = item.GetProperty("aaa", true); | ||
|
||
// Assert | ||
property.ShouldNotBeNull(); | ||
property.Value<string>().ShouldBe("123"); | ||
} | ||
|
||
[Fact] | ||
public void GetProperty_when_property_is_present_and_throwIfMissing_is_false() | ||
{ | ||
// Arrange | ||
var item = new JObject() | ||
{ | ||
{ "aaa", "123" } | ||
}; | ||
|
||
// Act | ||
var property = item.GetProperty("aaa", false); | ||
|
||
// Assert | ||
property.ShouldNotBeNull(); | ||
property.Value<string>().ShouldBe("123"); | ||
} | ||
|
||
[Fact] | ||
public void GetProperty_returns_null_when_property_is_missing_and_throwIfMissing_is_false() | ||
{ | ||
// Arrange | ||
var item = new JObject() | ||
{ | ||
{ "aaa", "123" } | ||
}; | ||
|
||
// Act | ||
var property = item.GetProperty("zzz", false); | ||
|
||
// Assert | ||
property.ShouldBeNull(); | ||
} | ||
|
||
[Fact] | ||
public void GetProperty_throws_when_property_is_missing_and_throwIfMissing_is_true() | ||
{ | ||
// Arrange | ||
var item = new JObject() | ||
{ | ||
{ "aaa", "123" } | ||
}; | ||
|
||
// Act | ||
Should.Throw<ArgumentException>(() => item.GetProperty("zzz", true)); | ||
} | ||
|
||
[Fact] | ||
public void GetPropertyValue_when_property_is_present_and_default_value_is_provided() | ||
{ | ||
// Arrange | ||
var item = new JObject() | ||
{ | ||
{ "aaa", "123" } | ||
}; | ||
|
||
// Act | ||
var property = item.GetPropertyValue("aaa", "Default value"); | ||
|
||
// Assert | ||
property.ShouldBe("123"); | ||
} | ||
|
||
[Fact] | ||
public void GetPropertyValue_when_property_is_present_and_default_value_is_omitted() | ||
{ | ||
// Arrange | ||
var item = new JObject() | ||
{ | ||
{ "aaa", "123" } | ||
}; | ||
|
||
// Act | ||
var property = item.GetPropertyValue<string>("aaa"); | ||
|
||
// Assert | ||
property.ShouldBe("123"); | ||
} | ||
|
||
[Fact] | ||
public void GetPropertyValue_returns_default_value_when_property_is_missing() | ||
{ | ||
// Arrange | ||
var item = new JObject() | ||
{ | ||
{ "aaa", "123" } | ||
}; | ||
|
||
// Act | ||
var property = item.GetPropertyValue("zzz", "Default value"); | ||
|
||
// Assert | ||
property.ShouldBe("Default value"); | ||
} | ||
|
||
[Fact] | ||
public void GetPropertyValue_throws_when_property_is_missing() | ||
{ | ||
// Arrange | ||
var item = new JObject() | ||
{ | ||
{ "aaa", "123" } | ||
}; | ||
|
||
// Act | ||
Should.Throw<ArgumentException>(() => item.GetPropertyValue<string>("zzz")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.