Created
June 15, 2018 20:32
-
-
Save diegodfsd/f6622f69891a8e8980f786586fe6b8b2 to your computer and use it in GitHub Desktop.
Ensure.cs
This file contains hidden or 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
protected Instance(bool multichannel, string name, string url, string site = null, string assemblyName = null, string pathTemplates = null, | |
string dashboardRelativeUrl = null, int? numberOfLicenses = null, AttendanceProtocolSettings protocolSettings = null, Status status = Status.Inactive) : this() | |
{ | |
Ensure.Arg.NotEmpty(name, nameof(name)); | |
Ensure.Arg.NotEmpty(url, nameof(url)); | |
Ensure.Arg.Match(url, Validations.Url.SimpleUrlPattern, nameof(url)); | |
Ensure.Arg.Is(!multichannel || site.IsNotNullOrEmpty(), nameof(site)); | |
Ensure.Arg.Is(!multichannel || assemblyName.IsNotNullOrEmpty(), nameof(assemblyName)); | |
Ensure.Arg.Is(!multichannel || pathTemplates.IsNotNullOrEmpty(), nameof(pathTemplates)); | |
Ensure.Arg.Is(!multichannel || dashboardRelativeUrl.IsNotNullOrEmpty(), nameof(pathTemplates)); | |
Ensure.Arg.Is(!multichannel || numberOfLicenses.HasValue, nameof(pathTemplates)); | |
} |
This file contains hidden or 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
protected Instance(bool multichannel, string name, string url, string site = null, string assemblyName = null, string pathTemplates = null, | |
string dashboardRelativeUrl = null, int? numberOfLicenses = null, AttendanceProtocolSettings protocolSettings = null, Status status = Status.Inactive) : this() | |
{ | |
if (name.IsNullOrEmpty()) throw new ArgumentNullException(nameof(name)); | |
if (url.IsNullOrEmpty()) throw new ArgumentNullException(nameof(url)); | |
if (Validations.Url.Validate(url)) throw new UriFormatException(); | |
if (multichannel && site.IsNullOrEmpty()) throw new ArgumentNullException(nameof(site)); | |
if (multichannel && assemblyName.IsNullOrEmpty()) throw new ArgumentNullException(nameof(assemblyName)); | |
if (multichannel && pathTemplates.IsNullOrEmpty()) throw new ArgumentNullException(nameof(pathTemplates)); | |
if (multichannel && dashboardRelativeUrl.IsNullOrEmpty()) throw new ArgumentNullException(nameof(dashboardRelativeUrl)); | |
if (multichannel && !numberOfLicenses.HasValue) throw new ArgumentNullException(nameof(numberOfLicenses)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment