Example #1
0
        public void Values_given_to_extension_method___correct_Sample()
        {
            double[] values   = { 1, 2, 3 };
            var      expected = new Sample(values);

            var sut = new SampleBuilder();

            values.AddToSampleBuilder(sut).ToList();

            Sample actual = sut.GetSample();

            Assert.Multiple(() =>
            {
                CollectionAssert.AreEqual(expected.Values, actual.Values);
                Assert.AreEqual(expected.ToString(), actual.ToString());
            });
        }
Example #2
0
        public void IEnumerable_given___correct_Sample()
        {
            double[] values   = { 1, 2, 3 };
            var      expected = new Sample(values);

            var sut = new SampleBuilder();

            sut.Add(values.Select(i => i));

            Sample actual = sut.GetSample();

            Assert.Multiple(() =>
            {
                CollectionAssert.AreEqual(expected.Values, actual.Values);
                Assert.AreEqual(expected.ToString(), actual.ToString());
            });
        }
Example #3
0
        public void Array_given___correct_Sample()
        {
            double[] values   = { 1, 2, 3 };
            var      expected = new Sample(values);

            var sut = new SampleBuilder();

            double[] res    = sut.AddWithYield(values).ToArray();
            Sample   actual = sut.GetSample();

            Assert.Multiple(() =>
            {
                CollectionAssert.AreEqual(values, res);
                CollectionAssert.AreEqual(expected.Values, actual.Values);
                Assert.AreEqual(expected.ToString(), actual.ToString());
            });
        }
Example #4
0
        public void Value_given___correct_Sample()
        {
            double[] values   = { Math.PI, Math.E };
            var      expected = new Sample(values);

            var sut = new SampleBuilder();

            sut.Add(Math.PI);
            sut.Add(Math.E);

            Sample actual = sut.GetSample();

            Assert.Multiple(() =>
            {
                CollectionAssert.AreEqual(expected.Values, actual.Values);
                Assert.AreEqual(expected.ToString(), actual.ToString());
            });
        }
Example #5
0
        public void Add_item_then_AddWithYield_Array___correct_Sample_and_correct_yielding()
        {
            double[] values   = { 1, 2, 3 };
            var      expected = new Sample(new[] { 42d }.Concat(values));

            var sut = new SampleBuilder();

            sut.Add(42d);
            var    res    = sut.AddWithYield(values).ToArray();
            Sample actual = sut.GetSample();

            Assert.Multiple(() =>
            {
                CollectionAssert.AreEqual(values, res);
                CollectionAssert.AreEqual(expected.Values, actual.Values);
                Assert.AreEqual(expected.ToArray(), actual.ToArray());
            });
        }
Example #6
0
        public void Array_given___correct_Sample()
        {
            double[] values   = { 1, 2, 3 };
            var      expected = new Sample(values);

            var sut = new SampleBuilder();

            sut.Add(values);

            Sample actual = sut.GetSample();

            TestContext.WriteLine(actual);

            Assert.Multiple(() =>
            {
                CollectionAssert.AreEqual(expected.Values, actual.Values);
                Assert.AreEqual(expected.ToString(), actual.ToString());
            });
        }