public async Task VerifyThatIfCredentialsAreNullOnReadExceptionIsThrown() { var organizationIid = Guid.Parse("44d1ff16-8195-47d0-abfa-163bbba9bf39"); var organizationDto = new CDP4Common.DTO.Organization(organizationIid, 0); organizationDto.AddContainer(ClassKind.SiteDirectory, Guid.Parse("eb77f3e1-a0f3-412d-8ed6-b8ce881c0145")); var dal = new WspDal(); Assert.That(async() => await dal.Read(organizationDto, new CancellationToken()), Throws.TypeOf <InvalidOperationException>()); }
/// <summary> /// Instantiate and deserialize the properties of a <paramref name="Organization"/> /// </summary> /// <param name="jObject">The <see cref="JObject"/> containing the data</param> /// <returns>The <see cref="Organization"/> to instantiate</returns> public static CDP4Common.DTO.Organization FromJsonObject(JObject jObject) { var iid = jObject["iid"].ToObject <Guid>(); var revisionNumber = jObject["revisionNumber"].IsNullOrEmpty() ? 0 : jObject["revisionNumber"].ToObject <int>(); var organization = new CDP4Common.DTO.Organization(iid, revisionNumber); if (!jObject["excludedDomain"].IsNullOrEmpty()) { organization.ExcludedDomain.AddRange(jObject["excludedDomain"].ToObject <IEnumerable <Guid> >()); } if (!jObject["excludedPerson"].IsNullOrEmpty()) { organization.ExcludedPerson.AddRange(jObject["excludedPerson"].ToObject <IEnumerable <Guid> >()); } if (!jObject["isDeprecated"].IsNullOrEmpty()) { organization.IsDeprecated = jObject["isDeprecated"].ToObject <bool>(); } if (!jObject["modifiedOn"].IsNullOrEmpty()) { organization.ModifiedOn = jObject["modifiedOn"].ToObject <DateTime>(); } if (!jObject["name"].IsNullOrEmpty()) { organization.Name = jObject["name"].ToObject <string>(); } if (!jObject["shortName"].IsNullOrEmpty()) { organization.ShortName = jObject["shortName"].ToObject <string>(); } if (!jObject["thingPreference"].IsNullOrEmpty()) { organization.ThingPreference = jObject["thingPreference"].ToObject <string>(); } return(organization); }