示例#1
0
文件: TestsArr.cs 项目: yomunsam/Core
        public void TestFillZeroWithSource()
        {
            var actual = Arr.Fill(0, 3, "foo", foobar);

            CollectionAssert.AreEqual(
                new[]
            {
                "foo", "foo", "foo", "foo", "bar", "baz",
            }, actual);
        }
示例#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]);
        }
示例#3
0
文件: TestsArr.cs 项目: yomunsam/Core
        public void TestFillOutOfRangeWithSource()
        {
            var actual = Arr.Fill(4, 2, "foo", foobar);

            CollectionAssert.AreEqual(
                new[]
            {
                "foo", "bar", "baz", null, "foo", "foo",
            }, actual);
        }
示例#4
0
文件: TestsArr.cs 项目: yomunsam/Core
        public void TestFillZeroStart()
        {
            var actual = Arr.Fill(0, 5, "foo");

            CollectionAssert.AreEqual(
                new[]
            {
                "foo", "foo", "foo", "foo", "foo",
            }, actual);
        }
示例#5
0
文件: TestsArr.cs 项目: yomunsam/Core
        public void TestFill()
        {
            var actual = Arr.Fill(1, 5, "foo");

            CollectionAssert.AreEqual(
                new[]
            {
                null, "foo", "foo", "foo", "foo", "foo",
            }, actual);
        }
示例#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]);
        }
示例#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" });
            });
        }
示例#8
0
文件: TestsArr.cs 项目: yomunsam/Core
        public void TestFillThrowException()
        {
            Assert.ThrowsException <ArgumentOutOfRangeException>(() =>
            {
                Arr.Fill(-1, 3, "foo");
            });

            Assert.ThrowsException <ArgumentOutOfRangeException>(() =>
            {
                Arr.Fill(0, 0, "foo");
            });
        }
示例#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]);
        }
示例#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]);
        }