private T Create <T>(Iri iri) { var result = new MulticastObject(); result.SetProperty(typeof(IEntity).GetProperty(nameof(IEntity.Iri)), iri); return(result.ActLike <T>()); }
public void Setup() { var entity = new MulticastObject(); entity.SetProperty(PropertyInfo, "test"); Entity = entity.ActLike <IUnmappedProduct>(); PropertyInfo.GetAccessors().Last().Invoke(PropertyInfo, new object[] { Entity, "test", null }); }
public async Task Setup() { Result = new List <IResource>(); Client = new Mock <IHydraClient>(MockBehavior.Strict); var proxy = new MulticastObject(); proxy.SetProperty(HypermediaProcessorBase.ClientPropertyInfo, Client.Object); Collection = proxy.ActLike <ICollection>(); ScenarioSetup(); await TheTest(); }
public async Task Setup() { EntryPoint = new Mock <IHypermediaContainer>(MockBehavior.Strict); Client = new Mock <IHydraClient>(MockBehavior.Strict); Client.Setup(_ => _.GetResource(It.IsAny <IResource>())).ReturnsAsync(EntryPoint.Object); var proxy = new MulticastObject(); proxy.SetProperty(HypermediaProcessorBase.ClientPropertyInfo, Client.Object); ApiDocumentation = proxy.ActLike <IApiDocumentation>(); proxy.SetProperty( typeof(IApiDocumentation).GetProperty(nameof(IApiDocumentation.EntryPoint)), Resource.Of <IResource>(new Uri("http://temp.uri/api")).Object); await TheTest(); }
public void Setup() { Template = new Mock <IIriTemplate>(MockBehavior.Strict); Template.SetupGet(_ => _.Template).Returns("some-uri{?with_variable}"); var target = new Mock <IResource>(MockBehavior.Strict); target.SetupGet(_ => _.Iri).Returns(new Iri("test-url")); var context = new Mock <IEntityContext>(MockBehavior.Strict); context.Setup(_ => _.Create <ILink>(It.IsAny <Iri>())).Returns <Iri>(Create <ILink>); context.Setup(_ => _.Create <IResource>(It.IsAny <Iri>())).Returns <Iri>(Create <IResource>); var proxy = new MulticastObject(); proxy.SetProperty(typeof(IPointingResource).GetProperty(nameof(IPointingResource.BaseUrl)), new Uri("http://temp.uri/")); proxy.SetProperty(typeof(IPointingResource).GetProperty(nameof(IPointingResource.Target)), target.Object); proxy.SetProperty(typeof(IDereferencableLink).GetProperty(nameof(IDereferencableLink.Relation)), "test"); proxy.SetProperty(JsonLdHypermediaProcessor.IriTemplatePropertyInfo, Template.Object); proxy.SetProperty(typeof(IEntity).GetProperty(nameof(IEntity.Context)), context.Object); Link = proxy.ActLike <ITemplatedLink>(); TheTest(); }