// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using FluentAssertions;
using FluentAssertions.Execution;
using Microsoft.DotNet.Cli.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
public class FileInfoAssertions
private FileInfo _fileInfo;
public FileInfoAssertions(FileInfo file)
_fileInfo = file;
}
public FileInfo FileInfo => _fileInfo;
public AndConstraint<FileInfoAssertions> Exist(string because = "", params object[] reasonArgs)
Execute.Assertion
.ForCondition(_fileInfo.Exists)
.BecauseOf(because, reasonArgs)
.FailWithPreformatted($"Expected File {_fileInfo.FullName} to exist, but it does not.");
return new AndConstraint<FileInfoAssertions>(this);
public AndConstraint<FileInfoAssertions> NotExist(string because = "", params object[] reasonArgs)
.ForCondition(!_fileInfo.Exists)
.FailWithPreformatted($"Expected File {_fileInfo.FullName} to not exist, but it does.");