Example #1
0
        internal SearchResult(String fullPath, String userPath, FindData findData)
        {
            Contract.Requires(fullPath != null);
            Contract.Requires(userPath != null);

            FullPath = fullPath;
            UserPath = userPath;
            this.findData = findData;
        }
        public void FindFirstFile()
        {
            using (var tempDir = new TempDirectory())
            {
                var tempFile = tempDir.CreateTempFile("firstFile.txt");

                var data = new FindData();

                using (var handle = Win32Api.IO.FindFirstFile(tempFile.FullName, data))
                {
                    Assert.IsFalse(handle.IsInvalid);
                    Assert.IsFalse(handle.IsClosed);
                }
            }
        }
Example #3
0
        public void DateModified()
        {
            using (var tempDir = new TempDirectory())
            {
                var tempFile = tempDir.CreateTempFile("firstFile.txt");

                var dateTime = tempFile.LastWriteTime;

                var data = new FindData();

                using (var handle = Win32Api.IO.FindFirstFile(tempFile.FullName, data))
                {
                    Assert.IsFalse(handle.IsInvalid);
                    Assert.IsFalse(handle.IsClosed);
                    var actualDateTime = data.LastWriteTime.ToDateTime();
                    Assert.AreEqual(dateTime, actualDateTime);
                }
            }
        }
Example #4
0
        public void FileSize()
        {
            using (var tempDir = new TempDirectory())
            {
                var tempFile = tempDir.CreateTempFile("firstFile.txt");
                File.WriteAllText(tempFile.FullName, @"abcde12345");

                var size = tempFile.Length;

                var data = new FindData();
                using (var handle = Win32Api.IO.FindFirstFile(tempFile.FullName, data))
                {
                    Assert.IsFalse(handle.IsInvalid);
                    Assert.IsFalse(handle.IsClosed);

                    var fileSize = data.FileSize;
                    Assert.AreEqual(size, fileSize);
                }
            }
        }
Example #5
0
        public void CreatedDate()
        {
            using (var tempDir = new TempDirectory())
            {
                var tempFile = tempDir.CreateTempFile("firstFile.txt");

                var creationTime = tempFile.CreationTime;

                var data = new FindData();

                using (var handle = Win32Api.IO.FindFirstFile(tempFile.FullName, data))
                {
                    Assert.IsFalse(handle.IsInvalid);
                    Assert.IsFalse(handle.IsClosed);

                    var dataCreationTime = data.CreationTime.ToDateTime();
                    Assert.AreEqual(creationTime, dataCreationTime);
                }
            }
        }