public static DoctrinaDbContext Create() { var options = new DbContextOptionsBuilder <DoctrinaDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; var context = new DoctrinaDbContext(options); context.Database.EnsureCreated(); var activityId = new Iri("http://www.example.com/activityId/hashset"); context.Activities.Add(new ActivityEntity() { Id = activityId.ToString(), Hash = activityId.ComputeHash() }); context.Agents.AddRange(new AgentEntity[] { AgentsTestFixture.JamesCampbell(), AgentsTestFixture.JosephinaCampbell() }); context.SaveChanges(); return(context); }
private static IEnumerable <IDereferencableLink> CreateLink( IHydraResource owner, IDereferencableLink relationResource, IResource @object, Iri type) { var result = relationResource.Copy(GetNextIri(type.ToString().Replace(hydra.Namespace, String.Empty))); var proxy = result.Unwrap(); proxy.SetProperty(ResourceExtensions.TargetPropertyInfo, @object); result.Type.AddIfNotExist(type); result.Type.Remove(type == hydra.TemplatedLink ? hydra.Link : hydra.TemplatedLink); if (type == hydra.TemplatedLink && @object != null) { var templatedLink = result.ActLike <ITemplatedLink>(); proxy.SetProperty(IriTemplatePropertyInfo, @object.ActLike <IIriTemplate>()); result = templatedLink; } owner.Links.Add(result); return(new[] { result }); }
public void Should_concatenate_both_Uri_operands() { (UriA + UriB).ToString().Should().Be(UriA.ToString() + UriB.ToString()); }
public void Should_concatenate_both_operands() { (OperandA + OperandB).ToString().Should().Be(OperandA.ToString() + OperandB.ToString()); }
internal static bool IsHttp(this Iri iri) { return(iri != null && iri.ToString().StartsWith("http", StringComparison.OrdinalIgnoreCase)); }