FakeFile Class

Summary

Represents a fake file.
Namespace
Cake.Testing
Interfaces
Base Types
  • object
graph BT Type-->Base0["object"] Type-.->Interface0["IFile"] click Interface0 "/api/Cake.Core.IO/IFile" Type-.->Interface1["IFileSystemInfo"] click Interface1 "/api/Cake.Core.IO/IFileSystemInfo" Type["FakeFile"] class Type type-node

Syntax

public sealed class FakeFile : IFile, IFileSystemInfo

Properties

Name Value Summary
Attributes FileAttributes
Gets or sets the file attributes.
Content byte[]
Gets the content.
ContentLength long
Gets the length of the content.
Exists bool
Gets a value indicating whether this IFileSystemInfo exists.
Hidden bool
Gets a value indicating whether this IFileSystemInfo is hidden.
LastWriteTime DateTime
Gets the time when this IFileSystemInfo was last written to.
Length long
Gets the length of the file.
Path FilePath
Gets the path to the file.

Methods

Name Value Summary
Copy(FilePath, bool) void
Copies the file to the specified destination path.
Delete() void
Deletes the file.
Move(FilePath) void
Moves the file to the specified destination path.
Open(FileMode, FileAccess, FileShare) Stream
Opens the file using the specified options.
Resize(long) void
Resizes the file.
SetCreationTime(DateTime) IFile
Sets the date and time that the file was created.
SetCreationTimeUtc(DateTime) IFile
Sets the date and time, in Coordinated Universal Time (UTC), that the file was created.
SetLastAccessTime(DateTime) IFile
Sets the date and time that the specified file or directory was last accessed.
SetLastAccessTimeUtc(DateTime) IFile
Sets the date and time, in Coordinated Universal Time (UTC), that the specified file or directory was last accessed.
SetLastWriteTime(DateTime) IFile
Sets the date and time that the specified file or directory was last written to.
SetLastWriteTimeUtc(DateTime) IFile
Sets the date and time, in Coordinated Universal Time (UTC), that the specified file or directory was last written to.

Extension Methods

Name Value Summary
Dump<FakeFile>() string
Get a basic string representation of specified object.
Requires the Cake.Incubator addin
GetBinaryContent() byte[]
Gets the binary content of the specified file.
GetTextContent(Encoding) string
Gets the text content of the file.
GetTextContent() string
Gets the text content of the file.
HasUTF8BOM() bool
Determines if a specified file has a UTF-8 BOM.
Hide() FakeFile
Hides the specified file.
IsClrAssembly() bool
Checks if file has CLR PE Header.
IsIn<FakeFile>(FakeFile[]) bool
Checks if the source is contained in a list
Requires the Cake.Incubator addin
NotNull<FakeFile>(string) void
Throws an exception if the specified parameter's value is null.
Requires the Cake.Ftp addin
NotNull<FakeFile>(string) void
Requires the Cake.Issues addin
Open(FileMode, FileAccess) Stream
Opens the file using the specified options.
Open(FileMode) Stream
Opens the file using the specified options.
OpenRead() Stream
Opens the file for reading.
OpenWrite() Stream
Opens the file for writing. If the file already exists, it will be overwritten.
ReadLines(Encoding) IEnumerable<string>
Enumerates line in file.
SetContent(string) FakeFile
Sets the content of the provided file.
ThrowIfNull<FakeFile>(string, string) T
Throws a System.ArgumentNullException with a specific message if the value is null, otherwise returns the value
Requires the Cake.Incubator addin
ThrowIfNull<FakeFile>(string) T
Throws a System.ArgumentNullException if the value is null, otherwise returns the value
Requires the Cake.Incubator addin
ToDictionary() IDictionary<string, object>
Requires the Cake.DeployParams addin
ToStringWithNullMarkup() string
Requires the Cake.Issues addin