public void GetRandomFile_SupplyEmptyCollection_ReturnsNullInstance() { // arrange FileHelper fileHelper = new FileHelper(); // act AppFile result = fileHelper.GetRandomFile(new List<AppFile>()); // assert Assert.IsNull(result); }
public void GetRandomFile_SupplyNullCollection_ThrowsFileArgumentNullException() { // arrange FileHelper fileHelper = new FileHelper(); TestDelegate testDelegate = () => fileHelper.GetRandomFile(null); // act, assert Assert.That(testDelegate, Throws.Exception.TypeOf<ArgumentNullException>().With.Property("ParamName").EqualTo("files")); }
public void GetRandomFile_SupplyCollection_ReturnsAnyRandomInstance(int filesCount) { // arrange FileHelper fileHelper = new FileHelper(); List<AppFile> files = new List<AppFile>(); for (int i = 0; i < filesCount; i++) { files.Add(new AppFile {}); } // act AppFile result = fileHelper.GetRandomFile(files); // assert Assert.Contains(result, files); }