Пример #1
0
        public void FileListing_GetHashCode_Not_Equal_To_Zero()
        {
            const string expectedName        = "testName";
            const string expectedFullName    = "testFullName";
            const bool   expectedIsDirectory = false;

            var expectedChildren = new Collection <IFileListing>
            {
                new FileListing {
                    Name = "childNameOne"
                },
                new FileListing {
                    Name = "childNameTwo"
                }
            };

            var mockFileListing = new Mock <IFileListing>();

            mockFileListing.Setup(fileList => fileList.Name).Returns(expectedName);
            mockFileListing.Setup(fileList => fileList.FullName).Returns(expectedFullName);
            mockFileListing.Setup(fileList => fileList.IsDirectory).Returns(expectedIsDirectory);

            var fileListing = new FileListing(mockFileListing.Object)
            {
                Children = expectedChildren
            };

            var hashCode = fileListing.GetHashCode();

            Assert.AreNotEqual(0, hashCode);
        }
Пример #2
0
        public void FileListing_GetHashCode_Expect_Zero()
        {
            var fileListing = new FileListing();

            var hashCode = fileListing.GetHashCode();

            Assert.AreEqual(0, hashCode);
        }