public IHttpActionResult GetOrganization(Guid organizationId) { if (organizationId == Guid.Empty) { throw new ArgumentException("organizationId must be ´defined."); } Organization organization = mapperFactory.CreateOrganizationMapper().Map(identityManagementService.GetOrganization(organizationId)); return(Ok(organization)); }
public void GetOrganization() { IOrganization organization = Substitute.For <IOrganization>(); organization.IsDisabled.Returns(true); organization.Name.Returns("OrganizationName"); organization.Description.Returns("MyDescription"); identityManagementService.GetOrganization(Arg.Any <Guid>()).Returns(organization); OkNegotiatedContentResult <Organization> response = sut.GetOrganization(Guid.NewGuid()) as OkNegotiatedContentResult <Organization>; Assert.IsNotNull(response); Assert.IsNotNull(response.Content); Assert.IsTrue(response.Content.IsDisabled); Assert.AreEqual("OrganizationName", response.Content.Name); Assert.AreEqual("MyDescription", response.Content.Description); }