Exemplo n.º 1
0
        public void ConcatNew_ShouldMaintainOldChain(params string[] parms)
        {
            // arrange
            var extraPath = new CodePath();
            var sut       = new CodePath();

            foreach (var name in parms)
            {
                var mockedMethod = Mock.Create <Method>();
                Mock.Arrange(() => mockedMethod.FullName).Returns(name);
                extraPath.AddLast(mockedMethod);
                sut.AddLast(mockedMethod);
            }

            // act
            sut.ConcatNew(extraPath);

            // assert
            var actualCount = sut.Count();

            Assert.Equal(parms.Length, actualCount);
            Assert.Equal(parms.Length, sut.Length);

            var index = 0;

            foreach (var method in sut)
            {
                Assert.Equal(parms[index++], method.FullName);
            }
        }
Exemplo n.º 2
0
        public void AddLastNew_AddMultiple_ShouldAddAllNodes(params string[] parms)
        {
            // arrange
            var sut  = new CodePath();
            var list = new List <Method>();

            foreach (var name in parms)
            {
                var mockedMethod = Mock.Create <Method>();
                Mock.Arrange(() => mockedMethod.FullName).Returns(name);
                list.Add(mockedMethod);
            }

            // act
            foreach (var method in list)
            {
                sut = sut.AddLastNew(method);
            }


            // assert
            Assert.Equal(parms.Length, sut.Count());
            Assert.Equal(parms.Length, sut.Length);
            foreach (var pair in sut.Zip(parms, (x, y) => new KeyValuePair <Method, String>(x, y)))
            {
                Assert.Equal(pair.Value, pair.Key.FullName);
            }
        }
Exemplo n.º 3
0
        public void AddLast_AddMultiple_ShouldHaveProperLength(params string[] parms)
        {
            // arrange
            var sut  = new CodePath();
            var list = new List <Method>();

            foreach (var name in parms)
            {
                var mockedMethod = Mock.Create <Method>();
                Mock.Arrange(() => mockedMethod.FullName).Returns(name);
                list.Add(mockedMethod);
            }

            // act
            foreach (var method in list)
            {
                sut.AddLast(method);
            }

            Assert.Equal(parms.Length, sut.Count());

            // assert
            Assert.Equal(parms.Length, sut.Length);
        }