示例#1
0
        public Task when_domain_was_created()
        {
            var data = Fixture
                       .CreateMany <DomainWasCreated>(new Random().Next(1, 100))
                       .Select(@event =>
            {
                var expectedRecord = new DomainDetail
                {
                    Name = @event.DomainName,
                    SecondLevelDomain = @event.SecondLevelDomain,
                    TopLevelDomain    = @event.TopLevelDomain
                };

                return(new
                {
                    DomainWasCreated = @event,
                    ExpectedRecord = expectedRecord
                });
            }).ToList();

            return(new DomainDetailProjections()
                   .Scenario()
                   .Given(data.Select(d => d.DomainWasCreated))
                   .Expect(TestOutputHelper, data.Select(d => d.ExpectedRecord)));
        }
示例#2
0
        public DomainDetailResponse(
            DomainDetail domainDetail)
        {
            Name = domainDetail.Name;
            SecondLevelDomain = domainDetail.SecondLevelDomain;
            TopLevelDomain    = domainDetail.TopLevelDomain;

            Services = domainDetail
                       .Services
                       .Select(x => new DomainDetailServiceResponse(domainDetail.Name, x.ServiceId, x.Type, x.Label))
                       .ToList();

            Records = domainDetail
                      .RecordSet
                      .Select(x => new DomainDetailRecordResponse(x.Type, x.TimeToLive, x.Label, x.Value))
                      .ToList();

            Links = new List <Link>
            {
                new Link("/", Link.Relations.Home, WebRequestMethods.Http.Get),
                new Link("/domains", Link.Relations.Domains, WebRequestMethods.Http.Get),
                new Link($"/domains/{domainDetail.Name}/services", Link.Relations.Services, WebRequestMethods.Http.Get),
                new Link($"/domains/{domainDetail.Name}/services/{ServiceType.manual.Value}", Link.Relations.Service, WebRequestMethods.Http.Post),
                new Link($"/domains/{domainDetail.Name}/services/{ServiceType.googlesuite.Value}", Link.Relations.Service, WebRequestMethods.Http.Post)
            };
        }
 public DomainServiceListResponse(
     DomainDetail domainDetail)
 {
     Links = new List <Link>
     {
         new Link("/", Link.Relations.Home, WebRequestMethods.Http.Get),
         new Link("/domains", Link.Relations.Domains, WebRequestMethods.Http.Get),
         new Link($"/domains/{domainDetail.Name}", Link.Relations.Domain, WebRequestMethods.Http.Get),
         new Link($"/domains/{domainDetail.Name}/services/{ServiceType.manual.Value}", Link.Relations.Service, WebRequestMethods.Http.Post),
         new Link($"/domains/{domainDetail.Name}/services/{ServiceType.googlesuite.Value}", Link.Relations.Service, WebRequestMethods.Http.Post)
     };
 }
        public DomainServiceListItemResponse(
            DomainDetail domainDetail,
            DomainDetail.DomainDetailService domainDetailService)
        {
            ServiceId = domainDetailService.ServiceId;
            Type      = domainDetailService.Type;
            Label     = domainDetailService.Label;

            Links = new List <Link>
            {
                new Link($"/domains/{domainDetail.Name}/services/{domainDetailService.ServiceId}", Link.Relations.Service, WebRequestMethods.Http.Get)
            };
        }