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()); }); }
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()); }); }
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()); }); }
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()); }); }
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()); }); }
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()); }); }