public void LicenseHasNoDate() { string[] emptyStrings = new[] { null, string.Empty, " " }; foreach (var value in emptyStrings) { Assert.That(() => _licenseDateParser.GetDateTimeOffsetFromLicenseDateString(value), Throws.TypeOf <LicenseDateCanNotBeNullException>()); } }
private DateTimeOffset GetLicenseDate(byte[] licenseBytes) { string license = Encoding.UTF8.GetString(licenseBytes); string licenseDateString = license.Split(new string[] { Environment.NewLine }, StringSplitOptions.None).ElementAtOrDefault(LicenseDateIsAtLine - 1); if (string.IsNullOrWhiteSpace(licenseDateString)) { throw new CanNotReadDateFromLicenseFileException(LicenseDateIsAtLine); } return(_licenseDateParser.GetDateTimeOffsetFromLicenseDateString(licenseDateString)); }