示例#1
0
 public static TConfiguration Add <TConfiguration>(this ListConfiguration <TConfiguration, VirtualType> source,
                                                   params Func <VirtualTypeBuilder, VirtualType>[] typeBuilders
                                                   ) => source.Add(
     typeBuilders.Select(builder =>
                         builder(BuildRoutine.VirtualType())
                         )
     );
示例#2
0
        public void Facade_when_adding_item__parent_configuration_can_be_used()
        {
            var testing = new ListConfiguration <string, string>("dummy", "test");

            testing.Add(s => s.ToCharArray().Select(c => c.ToString(CultureInfo.InvariantCulture)));
            testing.Add(s => s.Replace("d", "s").Replace("m", "n"));

            var actual = testing.Get();

            Assert.AreEqual(6, actual.Count);
            Assert.AreEqual("d", actual[0]);
            Assert.AreEqual("u", actual[1]);
            Assert.AreEqual("m", actual[2]);
            Assert.AreEqual("m", actual[3]);
            Assert.AreEqual("y", actual[4]);
            Assert.AreEqual("sunny", actual[5]);
        }
示例#3
0
        public void Returns_added_items()
        {
            var testing = new ListConfiguration <string, string>("dummy", "test");

            testing.Add(new List <string> {
                "1", "2"
            });
            testing.Add(new List <string> {
                "3", "4"
            });

            var actual = testing.Get();

            Assert.AreEqual(4, actual.Count);
            Assert.AreEqual("1", actual[0]);
            Assert.AreEqual("2", actual[1]);
            Assert.AreEqual("3", actual[2]);
            Assert.AreEqual("4", actual[3]);
        }
示例#4
0
        public void Facade_add_params_array()
        {
            var testing = new ListConfiguration <string, string>("dummy", "test");

            testing.Add("1", "2");
            var actual = testing.Get();

            Assert.AreEqual(2, actual.Count);
            Assert.AreEqual("1", actual[0]);
            Assert.AreEqual("2", actual[1]);
        }
示例#5
0
        public void Merges_with_other_ListConfiguration_adding_other_s_items_to_the_end()
        {
            var testing      = new ListConfiguration <string, string>("dummy", "test");
            var testingOther = new ListConfiguration <string, string>("dummy", "test");

            testing.Add("1", "2");
            testingOther.Add("3", "4");

            testing.Merge(testingOther);

            var actual = testing.Get();

            Assert.AreEqual(4, actual.Count);
            Assert.AreEqual("1", actual[0]);
            Assert.AreEqual("2", actual[1]);
            Assert.AreEqual("3", actual[2]);
            Assert.AreEqual("4", actual[3]);
        }
示例#6
0
 public static TConfiguration Add <TConfiguration>(
     this ListConfiguration <TConfiguration, IHeaderProcessor> source,
     Func <HeaderProcessorBuilder, IHeaderProcessor> builder
     ) => source.Add(builder(BuildRoutine.HeaderProcessor()));
示例#7
0
 public static TConfiguration Add <TConfiguration>(this ListConfiguration <TConfiguration, IParameter> source,
                                                   Func <ParameterBuilder, IParameter> builder
                                                   ) where TConfiguration : IParametric =>
 source.Add(o => builder(BuildRoutine.Parameter(o)));
示例#8
0
 public static TConfiguration Add <TConfiguration>(this ListConfiguration <TConfiguration, IMethod> source,
                                                   Func <MethodBuilder, IMethod> builder
                                                   ) where TConfiguration : IType =>
 source.Add(t => builder(BuildRoutine.Method(t)));