Dev2.Tests.DeleteHelperTest.DeleteHelper_Delete_WhenPathContainsJustFile_ExpectTrue C# (CSharp) Method

DeleteHelper_Delete_WhenPathContainsJustFile_ExpectTrue() private method

        public void DeleteHelper_Delete_WhenPathContainsJustFile_ExpectTrue()
        {
            //------------Setup for test--------------------------
            var tmpPath = Path.GetTempPath() + Guid.NewGuid();
            Directory.CreateDirectory(tmpPath);
            File.Create(tmpPath + "\\a.txt").Close();
            Directory.CreateDirectory(tmpPath + "\\b");

            //------------Execute Test---------------------------
            var result = DeleteHelper.Delete(tmpPath + "\\a.txt");

            var dirStillExit = Directory.Exists(tmpPath);
            var contents = Directory.GetFiles(tmpPath);
            var bDirStillExit = Directory.Exists(tmpPath + "\\b");

            Cleanup(tmpPath);

            //------------Assert Results-------------------------
            Assert.IsTrue(result);
            Assert.IsTrue(dirStillExit);
            Assert.AreEqual(0, contents.Length);
            Assert.IsTrue(bDirStillExit);
        }