コード例 #1
0
 public ConfigurationEditorEndpoint(IHttpResponseFactory httpResponseFactory, IConfigInstanceRouter configInstanceRouter, IConfigurationEditModelMapper configurationEditModelMapper, IConfigurationModelRegistry configCollection, IConfigurationClientService configClientService, ICommandBus commandBus)
 {
     this.httpResponseFactory          = httpResponseFactory;
     this.configCollection             = configCollection;
     this.configInstanceRouter         = configInstanceRouter;
     this.configurationEditModelMapper = configurationEditModelMapper;
     this.configClientService          = configClientService;
     this.commandBus = commandBus;
 }
コード例 #2
0
 public ConfigurationSetEnpoint(IConfigHttpResponseFactory responseFactory, IConfigurationSetModelPayloadMapper modelPayloadMapper, IConfigInstanceRouter configInstanceRouter, IConfigurationEditModelMapper configurationEditModelMapper, IConfigurationUpdatePayloadMapper configurationUpdatePayloadMapper, ConfigurationSetRegistry configCollection, IConfigRepository configRepository, IConfigurationValidator validator, IEventService eventService)
 {
     this.responseFactory              = responseFactory;
     this.configCollection             = configCollection;
     this.modelPayloadMapper           = modelPayloadMapper;
     this.configInstanceRouter         = configInstanceRouter;
     this.configurationEditModelMapper = configurationEditModelMapper;
     this.configRepository             = configRepository;
     this.validator = validator;
     this.configurationUpdatePayloadMapper = configurationUpdatePayloadMapper;
     this.eventService = eventService;
 }
コード例 #3
0
        public ConfigurationEditModelMapperTests()
        {
            configurationSet = new Mock <IConfigurationSetService>();
            configurationSet.Setup(r => r.GetConfigurationSet(typeof(SampleConfigSet), It.IsAny <ConfigurationIdentity>()))
            .ReturnsAsync(() => new SampleConfigSet {
                Options = new OptionSet <OptionFromConfigSet>(OptionFromConfigSet.Options, o => o.Id.ToString(), o => o.Description)
            });

            target     = new ConfigurationEditModelMapper(new TestOptionSetFactory(), new PropertyTypeProvider(), configurationSet.Object);
            definition = new SampleConfigSet().BuildConfigurationSetModel();
            sample     = new SampleConfig
            {
                Choice        = Choice.OptionThree,
                IsLlamaFarmer = true,
                Decimal       = 0.23m,
                StartDate     = new DateTime(2013, 10, 10),
                LlamaCapacity = 47,
                Name          = "Name 1",
                Option        = OptionProvider.OptionOne,
                MoarOptions   = new List <Option> {
                    OptionProvider.OptionOne, OptionProvider.OptionThree
                },
                ListOfConfigs = new List <ListConfig> {
                    new ListConfig {
                        Name = "One", Value = 23
                    }
                },
                NestedClass = new NestedClass {
                    Count = 23, Description = "Test"
                },
                ListOfInts = new List <int> {
                    1, 2, 3
                },
                ListOfStrings = new List <string> {
                    "Hello", "World"
                },
            };

            updatedSample = new SampleConfig
            {
                Choice        = Choice.OptionTwo,
                IsLlamaFarmer = false,
                Decimal       = 0.213m,
                StartDate     = new DateTime(2013, 10, 11),
                LlamaCapacity = 147,
                Name          = "Name 2",
                Option        = OptionProvider.OptionTwo,
                MoarOptions   = new List <Option> {
                    OptionProvider.OptionTwo, OptionProvider.OptionThree
                },
                ListOfConfigs = new List <ListConfig> {
                    new ListConfig {
                        Name = "Two plus Two", Value = 5
                    }
                },
                NestedClass = new NestedClass {
                    Count = 37, Description = "Test2"
                },
                ListOfInts = new List <int> {
                    1, 3, 4
                },
                ListOfStrings = new List <string> {
                    "Bye", "World"
                },
            };
            dynamic updatedValue = new ExpandoObject();

            updatedValue.Choice        = updatedSample.Choice;
            updatedValue.IsLlamaFarmer = updatedSample.IsLlamaFarmer;
            updatedValue.Decimal       = updatedSample.Decimal;
            updatedValue.StartDate     = updatedSample.StartDate;
            updatedValue.LlamaCapacity = updatedSample.LlamaCapacity;
            updatedValue.Name          = updatedSample.Name;
            updatedValue.Option        = updatedSample.Option.Id;
            updatedValue.MoarOptions   = updatedSample.MoarOptions.Select(s => s.Id).ToList();
            updatedValue.ListOfConfigs = updatedSample.ListOfConfigs;
            updatedValue.NestedClass   = updatedSample.NestedClass;
            updatedValue.ListOfInts    = updatedSample.ListOfInts;
            updatedValue.ListOfStrings = updatedSample.ListOfStrings;


            var serilaisationSetting = new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };
            var json = JsonConvert.SerializeObject(updatedValue, serilaisationSetting);

            updatedObject = JObject.Parse(json);
        }
コード例 #4
0
 public UploadToEditorModelMapper(IConfigurationEditModelMapper configurationEditModelMapper, IConfigurationUploadMapper uploadMapper)
 {
     this.configurationEditModelMapper = configurationEditModelMapper;
     this.uploadMapper = uploadMapper;
 }