Ejemplo n.º 1
0
 public GetMakerSpaceByIdResponse(MakerSpace ms)
 {
     Id           = ms.Id;
     Name         = ms.Name;
     WorkShopType = ms.WorkShopType;
     Description  = ms.Description;
     if (!(ms.Address is null))
     {
         Address = AddressViewmodel.Create(ms.Address);
     }
     if (!(ms.ContactInfo is null))
     {
         ContactInformation = ContactInformationViewModel.Create(ms.ContactInfo);
     }
     VATNumber  = ms.VATNumber;
     LogoUrl    = ms.Logo.ToString();
     AccessType = ms.AccessType;
     if (!string.IsNullOrWhiteSpace(ms.Organization))
     {
         Organization = ms.Organization;
     }
     Tools   = ms.Tools.Select(x => x.Name).ToList();
     Members = ms.Members.Select(x => new UserVM {
         UserName = x.UserName, SchoolName = x.SchoolName
     }).ToList();
 }
        internal static MakerSpaceViewmodel Create(MakerSpace ms)
        {
            var msResponse = new MakerSpaceViewmodel();

            msResponse.Id           = ms.Id;
            msResponse.Name         = ms.Name;
            msResponse.WorkShopType = ms.WorkShopType;
            msResponse.Description  = ms.Description;
            if (!(ms.Address is null))
            {
                msResponse.Address = AddressViewmodel.Create(ms.Address);
            }
            if (!(ms.ContactInfo is null))
            {
                msResponse.ContactInformation = ContactInformationViewModel.Create(ms.ContactInfo);
            }
            msResponse.VATNumber = ms.VATNumber;
            msResponse.LogoUrl   = ms.Logo;
            ms.AccessType        = ms.AccessType;
            if (!string.IsNullOrWhiteSpace(ms.Organization))
            {
                msResponse.Organization = ms.Organization;
            }
            msResponse.Tools = ms.Tools.Select(x => x.Name).ToList();

            return(msResponse);
        }
Ejemplo n.º 3
0
        public void ConvertContactInfoToViewmodel()
        {
            //Arrange
            var contactInfo = _requestFixture.Fixture.Create <ContactInfo>();

            //Act
            var ciVM = ContactInformationViewModel.Create(contactInfo);

            //Assert
            ciVM.Email.Should().Be(contactInfo.Email);
            ciVM.Phone.Should().Be(contactInfo.Phone);
        }