Why does launching Pex Explorations ignore the previously created Pex testing method?

Checked code:

public class TestReader { public string Content { get; private set; } public void LoadFile(string fileName) { var content = FileSystem.ReadAllText(fileName); if (!content.StartsWith("test")) throw new ArgumentException("invalid file"); this.Content = content; } } public static class FileSystem { public static string ReadAllText(string fileName) { return File.ReadAllText(fileName); } } 

Pex method in test project:

 [PexMethod] public void CheckValidFileWithPex(string content) { // arrange var fileName = "test.txt"; Moles_Example.Moles.MFileSystem.ReadAllTextString = delegate(string f) { Assert.IsTrue(f == fileName); return content; }; // act var test = new TestReader(); test.LoadFile(fileName); // assert Assert.AreEqual(content, test.Content); } 

When I first run Pex Explorations on CheckValidFileWithPex(string content) , five test methods are generated with the following values ​​for content :

  • Null
  • ""
  • "\ 0 \ 0 \ 0 \ 0"
  • "test"
  • "\ 0 \ 0 \ 0 \ 0 \ 0"

However, if I ran Pex Explorations again, there were no changes made to the generated tests, the existing code of the test project or the main project before the second run, then only 4 tests are listed as generated, and the test input is 3 ("\ 0 \ 0 \ 0 \ 0 ") is missing.

The source code for the test file created by Pex still has a verification method for this case, but I don’t understand why this case is not listed in the results of the Pex study.

Thank you for your understanding.

+4
source share

All Articles