public void ScanPackages() { PackageScanner test = new PackageScanner(PlatformManagerMock.Object, PackageFactoryMock.Object); IResult <IList <IPackage> > result = test.ScanPackages(); Assert.Equal(ResultCode.Success, result.ResultCode); Assert.Equal(1, result.ReturnValue.Count); Assert.Equal(PackageMock.Object, result.ReturnValue[0]); }
public void ScanPackagesListFailure() { PlatformMock.Setup(p => p.ListDirectories(It.IsAny <string>())) .Returns(new Result <IList <string> >(ResultCode.Failure)); PackageScanner test = new PackageScanner(PlatformManagerMock.Object, PackageFactoryMock.Object); IResult <IList <IPackage> > result = test.ScanPackages(); Assert.Equal(ResultCode.Failure, result.ResultCode); Assert.Equal(0, result.ReturnValue.Count); }
public void ScanPackagesSkipArchiveDirectory() { IResult <IList <string> > listResult = new Result <IList <string> >() .SetReturnValue(new List <string>(new[] { string.Empty, "archives" })); PlatformMock.Setup(p => p.ListDirectories(It.IsAny <string>())) .Returns(listResult); PackageScanner test = new PackageScanner(PlatformManagerMock.Object, PackageFactoryMock.Object); IResult <IList <IPackage> > result = test.ScanPackages(); Assert.Equal(ResultCode.Success, result.ResultCode); Assert.Equal(1, result.ReturnValue.Count); Assert.Equal(PackageMock.Object, result.ReturnValue[0]); }