public void StringJoinTestCase()
        {
            var dictionary = new Dictionary<String, String>
            {
                { RandomValueEx.GetRandomString(), RandomValueEx.GetRandomString() },
                { RandomValueEx.GetRandomString(), RandomValueEx.GetRandomString() }
            };

            var actual = dictionary.StringJoin();
            var expected = "{0}={1}{2}={3}".F( dictionary.First()
                                                         .Key,
                                               dictionary.First()
                                                         .Value,
                                               dictionary.Last()
                                                         .Key,
                                               dictionary.Last()
                                                         .Value );
            Assert.AreEqual( expected, actual );

            actual = dictionary.StringJoin( ",", ";" );
            expected = "{0},{1};{2},{3}".F( dictionary.First()
                                                      .Key,
                                            dictionary.First()
                                                      .Value,
                                            dictionary.Last()
                                                      .Key,
                                            dictionary.Last()
                                                      .Value );
            Assert.AreEqual( expected, actual );
        }
        public void StringJoinTest()
        {
            var dictionary = new Dictionary <String, String>
            {
                { RandomValueEx.GetRandomString(), RandomValueEx.GetRandomString() },
                { RandomValueEx.GetRandomString(), RandomValueEx.GetRandomString() }
            };

            var actual   = dictionary.StringJoin();
            var expected = "{0}={1}{2}={3}".F(dictionary.First()
                                              .Key,
                                              dictionary.First()
                                              .Value,
                                              dictionary.Last()
                                              .Key,
                                              dictionary.Last()
                                              .Value);

            Assert.Equal(expected, actual);

            actual   = dictionary.StringJoin(",", ";");
            expected = "{0},{1};{2},{3}".F(dictionary.First()
                                           .Key,
                                           dictionary.First()
                                           .Value,
                                           dictionary.Last()
                                           .Key,
                                           dictionary.Last()
                                           .Value);
            Assert.Equal(expected, actual);
        }
        public void StringJoinTestNullCheck()
        {
            Dictionary <String, String> dictionary = null;
            // ReSharper disable once AssignNullToNotNullAttribute
            // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            Action test = () => dictionary.StringJoin("");

            test.ShouldThrow <ArgumentNullException>();
        }
Beispiel #4
0
        public static void Main()
        {
            var numbers = Enumerable.Range(0, 10).ToList();

            // numbers.ForEach(x => Console.Write(x + " "));

            var dict = new Dictionary<string, bool>();

            dict.Insert(t => true, gosho => false, penka => false, ivan => true);

            Console.WriteLine(dict.StringJoin());

            //string[] stuff = { "-120", "10", "3", "3492394", "8", "-1", "-2345324" };

            //// stuff.ForEach(s => s.QuickParse().Print());

            //numbers.ForEach(x => x.QuickPow(4).Print());

            //var listRange = new List<int>();

            //listRange.Range(1, 6, 3);

            //Console.WriteLine(listRange.StringJoin());

            //var person = new Person("Pesho", "HSRL Rakovski, Bourgas");
            //person.Homeworks.Add("1324123413");
            //person.Homeworks.Add("32");
            //person.Homeworks.Add("5");

            //Console.WriteLine(person.PrintGeneric());

            //var lookupString = "pesho";

            //Console.WriteLine(lookupString.IsIn("vanya", "Mariya", "Koce", "Boce", "pesho"));

            // "npesheva".AppendInFile("../../gosho.txt");

            Console.WriteLine("34".Transform(x => int.Parse(x)).Transform(x =>
            {
                var result = new StringBuilder();

                Enumerable
                    .Range(0, 15)
                    .ForEach(i => result.AppendLine((i ^ x).ToString()));

                return result;
            }));
        }