Пример #1
0
        public string GetJson()
        {
            var sampleList = SampleGenerator.GenerateCustomSampleList(3050000, 0, 20);

            var json = JsonConvert.SerializeObject(sampleList);
            var size = Encoding.Unicode.GetByteCount(json); // just to check size

            return(json);
        }
Пример #2
0
        public void Test3_Cancellation()
        {
            var  sampleList = SampleGenerator.GenerateCustomSampleList(1000, 1, 10);
            long qtyTotal   = (from s in sampleList
                               select s.Qty).Sum();

            var result = ParallelExercise(sampleList, true);

            // Assert: should fail and throw OperationCanceledException (check test explorer message)
        }
Пример #3
0
        public void Test3_OutOfRangeException()
        {
            var  sampleList = SampleGenerator.GenerateCustomSampleList(1000, 20, 30);
            long qtyTotal   = (from s in sampleList
                               select s.Qty).Sum();

            var result = ParallelExercise(sampleList);

            // Assert: should fail and throw ArgumentOutOfRangeException (check test explorer message)
        }
Пример #4
0
        public void Test3_IfSampleListCorrect()
        {
            var sampleList = SampleGenerator.GenerateCustomSampleList(400000, 1, 20);
            int qtyTotal   = (from s in sampleList
                              select s.Qty).Sum();

            var result = ParallelExercise(sampleList);

            Assert.Equal(qtyTotal, result);
        }
Пример #5
0
        public void Test1()
        {
            var sampleList1 = SampleGenerator.GenerateCustomSampleList(500000, 0, 20);
            var sampleList2 = SampleGenerator.GenerateSampleList2();

            var newSampleList = (from s1 in sampleList1
                                 join s2 in sampleList2
                                 on s1.Id equals s2.Id
                                 select new Sample
            {
                Id = s1.Id,
                Content = s1.Content,
                Qty = s1.Qty
            }).ToList();

            Assert.NotEmpty(newSampleList);
        }