예제 #1
0
 public void PrefilterViewModel(VmPrintableFormChannelStep1 vm)
 {
     if (vm.UrlAttachments != null)
     {
         vm.UrlAttachments = attachmentLogic.PrefilterModel(vm.UrlAttachments).ToList();
     }
 }
예제 #2
0
        /// <summary>
        /// test for PrintableFormChannelStep1TranslatorTest entity - > vm
        /// </summary>
        //[Fact]
        //public void TranslatePrintableFormChannelToModel()
        //{
        //    var toTranslate = new List<PrintableFormChannel>()
        //    {
        //        new PrintableFormChannel()
        //        {
        //            FormIdentifier = "form identifier",
        //            FormReceiver = "form receiver",
        //           // DeliveryAddressDescriptions = new List<PrintableFormChannelDeliveryAddressDescription>() { new PrintableFormChannelDeliveryAddressDescription() { Description = "printable form description" } }
        //        }
        //    };

        //    var translations = RunTranslationEntityToModelTest<PrintableFormChannel, VmPrintableFormChannelStep1>(translators, toTranslate);
        //    var translation = translations.First();

        //    Assert.Equal("form identifier", translation.FormIdentifier);
        //    Assert.Equal("form receiver", translation.FormReceiver);
        //   // Assert.Equal("printable form description", translation.DeliveryAddressDescription);
        //}

        private void CheckTranslation(VmPrintableFormChannelStep1 source, PrintableFormChannel target)
        {
            target.FormIdentifiers.Count.Should().Be(1);
            target.FormReceivers.Count.Should().Be(1);
            target.ChannelUrls.Count.Should().Be(source.WebPages.Count);
            // Assert.Equal(model.UrlAttachments.Count, translation.Attachments.Count);
            // target.Id.Should().Be(source.Id);
            target.Should().NotBe(Guid.Empty);
            target.DeliveryAddress.Should().NotBeNull();
        }
예제 #3
0
 public IServiceResultWrap SavePrintableFormChannelStep1Changes([FromBody] VmPrintableFormChannelStep1 model)
 {
     return(serviceManager.CallService(
                () => new ServiceLocalizedResultWrap(model)
     {
         Data = channelService.SavePrintableFormChannelStep1(model)
     },
                new Dictionary <Type, string>()
     {
         { typeof(string), MessageChannelStepSave },
         { typeof(PtvArgumentException), MessageArgumentException },
         { typeof(LockException), MessageLockedChannel },
         { typeof(RoleActionException), MessageSaveChannelRole }
     }
                ));
 }
예제 #4
0
        public static VmPrintableFormChannel CreateVmPrintableFormChannelModel()
        {
            var step1 = new VmPrintableFormChannelStep1()
            {
                PhoneNumbers = new List <VmPhone> {
                    CreateVmPhoneModel()
                },
                Emails = new List <VmEmailData> {
                    CreateVmEmailDataModel()
                },
                FormIdentifier = new Dictionary <string, string>()
                {
                    { "fi", "Form Identifier" }
                },
                FormReceiver = new Dictionary <string, string>()
                {
                    { "fi", "Form Receiver" }
                },
                DeliveryAddress = CreateVmAdressSimpleModel(),
                WebPages        = new List <VmWebPage>()
                {
                    CreateVmWebPageUrlModel()
                },
                UrlAttachments = new List <VmChannelAttachment>()
                {
                    CreateVmChannelAttachmentModel()
                }
            };

            SetupVmChannelDescriptionModel(step1);
            return(new VmPrintableFormChannel()
            {
                PublishingStatusId = Guid.NewGuid(),
                Step1Form = step1,
            });
        }