示例#1
0
 public HypermediaBuilder(
     IHypermediaService service,
     TDocument document)
 {
     Service  = service ?? throw new ArgumentNullException(nameof(service));
     Document = document ?? throw new ArgumentNullException(nameof(document));
 }
示例#2
0
        public HypermediaServiceExtensionTests()
        {
            mockDocument = new Mock <IHypermediaDocument>();

            mockSut = new Mock <IHypermediaService>();
            mockSut.Setup(x => x.GetLink()).Returns(new Link(TestHref));

            sut = mockSut.Object;
        }
        public static IHypermediaBuilder <TDocument> AddSelf <TDocument>(this IHypermediaService service, TDocument document)
            where TDocument : IHypermediaDocument
        {
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }

            if (document == null)
            {
                throw new ArgumentNullException(nameof(document));
            }

            var link = service.GetLink();

            document.AddLink(SelfRel, link);

            return(new HypermediaBuilder <TDocument>(service, document));
        }
 public StateModelFactory(IHypermediaService hypermediaService)
 {
     this.hypermediaService = hypermediaService;
 }
 public static IHypermediaBuilder <TDocument> Prepare <TDocument>(this IHypermediaService service, TDocument document)
     where TDocument : IHypermediaDocument
 {
     return(new HypermediaBuilder <TDocument>(service, document));
 }