# LibTmux.Testing.TmuxTestFactory.CreateSessionAsync

- **Module:** LibTmux.Testing
- **Package:** LibTmux
- **Language:** C#
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/cf34b255c896d19a97e7d7fabea58609c916012d/src/LibTmux.Testing/TmuxTestFactory.cs#L59
- **Page:** https://libtmux.org/en/csharp/latest/reference/libtmux-testing-tmuxtestfactory-createsessionasync/

```
LibTmux.Testing.TmuxTestFactory.CreateSessionAsync(options: TmuxTestOptions?, cancellationToken: CancellationToken) -> Task<TemporarySessionScope>

LibTmux.Testing.TmuxTestFactory.CreateSessionAsync(server: Server, options: TmuxTestOptions?, cancellationToken: CancellationToken) -> Task<TemporarySessionScope>
```

Starts a server and a session in it, both owned by this test.

The server this makes is left to the session's own scope, which is a
session on a server nobody else will kill.

## Parameters

- `options` (`TmuxTestOptions?`): How to reach tmux, or null for a socket of its own. (for `CreateSessionAsync(options, cancellationToken)`)
- `cancellationToken` (`CancellationToken`): Cancels the tmux commands.
- `server` (`Server`): The server to start it on. (for `CreateSessionAsync(server, options, cancellationToken)`)
- `options` (`TmuxTestOptions?`): What to name it, or null for a name of its own. (for `CreateSessionAsync(server, options, cancellationToken)`)

## Returns

The scope owning the session.
