Ejemplo n.º 1
0
        public void TestFillZeroWithSource()
        {
            var actual = Arr.Fill(0, 3, "foo", foobar);

            CollectionAssert.AreEqual(
                new[]
            {
                "foo", "foo", "foo", "foo", "bar", "baz",
            }, actual);
        }
Ejemplo n.º 2
0
        public void TestFillZeroStart()
        {
            var result = Arr.Fill(0, 5, "aaa");

            Assert.AreEqual("aaa", result[0]);
            Assert.AreEqual("aaa", result[1]);
            Assert.AreEqual("aaa", result[2]);
            Assert.AreEqual("aaa", result[3]);
            Assert.AreEqual("aaa", result[4]);
        }
Ejemplo n.º 3
0
        public void TestFillOutOfRangeWithSource()
        {
            var actual = Arr.Fill(4, 2, "foo", foobar);

            CollectionAssert.AreEqual(
                new[]
            {
                "foo", "bar", "baz", null, "foo", "foo",
            }, actual);
        }
Ejemplo n.º 4
0
        public void TestFillZeroStart()
        {
            var actual = Arr.Fill(0, 5, "foo");

            CollectionAssert.AreEqual(
                new[]
            {
                "foo", "foo", "foo", "foo", "foo",
            }, actual);
        }
Ejemplo n.º 5
0
        public void TestFill()
        {
            var actual = Arr.Fill(1, 5, "foo");

            CollectionAssert.AreEqual(
                new[]
            {
                null, "foo", "foo", "foo", "foo", "foo",
            }, actual);
        }
Ejemplo n.º 6
0
        public void TestFill()
        {
            var result = Arr.Fill(1, 5, "aaa");

            Assert.AreEqual(null, result[0]);
            Assert.AreEqual("aaa", result[1]);
            Assert.AreEqual("aaa", result[2]);
            Assert.AreEqual("aaa", result[3]);
            Assert.AreEqual("aaa", result[4]);
            Assert.AreEqual("aaa", result[5]);
        }
Ejemplo n.º 7
0
        public void TestFillException()
        {
            ExceptionAssert.Throws <ArgumentOutOfRangeException>(() =>
            {
                Arr.Fill(-1, 3, "aaa", new[] { "dog", "cat", "white", "red", "world" });
            });

            ExceptionAssert.Throws <ArgumentOutOfRangeException>(() =>
            {
                Arr.Fill(0, 0, "aaa", new[] { "dog", "cat", "white", "red", "world" });
            });
        }
Ejemplo n.º 8
0
        public void TestFillThrowException()
        {
            Assert.ThrowsException <ArgumentOutOfRangeException>(() =>
            {
                Arr.Fill(-1, 3, "foo");
            });

            Assert.ThrowsException <ArgumentOutOfRangeException>(() =>
            {
                Arr.Fill(0, 0, "foo");
            });
        }
Ejemplo n.º 9
0
        public void TestFillZeroWithSource()
        {
            var result = Arr.Fill(0, 3, "aaa", new[] { "dog", "cat", "white", "red", "world" });

            Assert.AreEqual("aaa", result[0]);
            Assert.AreEqual("aaa", result[1]);
            Assert.AreEqual("aaa", result[2]);
            Assert.AreEqual("dog", result[3]);
            Assert.AreEqual("cat", result[4]);
            Assert.AreEqual("white", result[5]);
            Assert.AreEqual("red", result[6]);
            Assert.AreEqual("world", result[7]);
        }
Ejemplo n.º 10
0
        public void TestFillWithSource()
        {
            var data   = new[] { "dog", "cat", "white", "red", "world" };
            var result = Arr.Fill(2, 3, "aaa", data);

            Assert.AreEqual("dog", result[0]);
            Assert.AreEqual("cat", result[1]);
            Assert.AreEqual("aaa", result[2]);
            Assert.AreEqual("aaa", result[3]);
            Assert.AreEqual("aaa", result[4]);
            Assert.AreEqual("white", result[5]);
            Assert.AreEqual("red", result[6]);
            Assert.AreEqual("world", result[7]);

            Assert.AreEqual("dog", data[0]);
            Assert.AreEqual("cat", data[1]);
            Assert.AreEqual("white", data[2]);
            Assert.AreEqual("red", data[3]);
            Assert.AreEqual("world", data[4]);
        }