public void ShouldSetDefaultsOnModel()
        {
            var actual   = new ContentfulGroup();
            var expected = new ContentfulGroup
            {
                Name        = string.Empty,
                Slug        = string.Empty,
                PhoneNumber = string.Empty,
                Email       = string.Empty,
                Website     = string.Empty,
                Twitter     = string.Empty,
                Facebook    = string.Empty,
                Address     = string.Empty,
                Description = string.Empty,
                Image       = new Asset {
                    File = new File {
                        Url = string.Empty
                    }, SystemProperties = new SystemProperties {
                        Type = "Asset"
                    }
                },
                MapPosition  = new MapPosition(),
                Volunteering = false
            };

            actual.Should().BeEquivalentTo(expected);
        }
예제 #2
0
        public GroupContentfulFactoryTest()
        {
            _timeProvider = new Mock <ITimeProvider>();

            _timeProvider.Setup(o => o.Now()).Returns(new DateTime(2017, 01, 01));
            _contentfulOrganisationFactory     = new Mock <IContentfulFactory <ContentfulOrganisation, Organisation> >();
            _contentfulGroupCategoryFactory    = new Mock <IContentfulFactory <ContentfulGroupCategory, GroupCategory> >();
            _contentfulGroupSubCategoryFactory = new Mock <IContentfulFactory <ContentfulGroupSubCategory, GroupSubCategory> >();
            _contentfulGroupBrandingFactory    = new Mock <IContentfulFactory <ContentfulGroupBranding, GroupBranding> >();
            _contentfulGroup        = new ContentfulGroupBuilder().Build();
            _alertFactory           = new Mock <IContentfulFactory <ContentfulAlert, Alert> >();
            _groupContentfulFactory = new GroupContentfulFactory(_contentfulOrganisationFactory.Object, _contentfulGroupCategoryFactory.Object, _contentfulGroupSubCategoryFactory.Object, _timeProvider.Object, _documentFactory.Object, _contentfulGroupBrandingFactory.Object, _alertFactory.Object);
        }
예제 #3
0
        private ManagementGroup ConvertToManagementGroup(Group group, List <ContentfulGroupCategory> referencedCategories, ContentfulGroup existingGroup)
        {
            var contentfulGroup = _mapper.Map <ContentfulGroup>(group);

            contentfulGroup.GroupBranding       = existingGroup.GroupBranding;
            contentfulGroup.CategoriesReference = referencedCategories;
            contentfulGroup.Image         = existingGroup.Image;
            contentfulGroup.SubCategories = existingGroup.SubCategories;
            contentfulGroup.Organisation  = existingGroup.Organisation;

            var managementGroup = new ManagementGroup();

            _mapper.Map(contentfulGroup, managementGroup);
            return(managementGroup);
        }
 public ContentfulEventBuilder Group(ContentfulGroup group)
 {
     _group = group;
     return(this);
 }