private static string MakeToken(AuthorizedTask authorizedTask)
        {
            var formatter = new AuthorizedTaskTokenFormatter();

            return(formatter.Format(new AuthorizedTaskTokenParts()
            {
                AuthorizationCode = authorizedTask.AuthorizationCode,
                AuthorizedTaskId = authorizedTask.AuthorizedTaskId
            }));
        }
        public async Task CreatesTask()
        {
            var uniqueData = UNIQUE_PREFIX + nameof(CreatesTask);
            var seedDate   = new DateTime(2018, 03, 20);

            using var app = _appFactory.Create();

            var addAuthorizedTaskCommand = await app
                                           .TestData
                                           .AuthorizedTasks()
                                           .AddWithNewUserAsync(uniqueData, seedDate, c => c.TaskData = uniqueData);

            var dbTask = await GetAuthorizedTaskAsync(addAuthorizedTaskCommand);

            var tokenFormatter = new AuthorizedTaskTokenFormatter();
            var token          = tokenFormatter.Format(new AuthorizedTaskTokenParts()
            {
                AuthorizationCode = dbTask.AuthorizationCode,
                AuthorizedTaskId  = dbTask.AuthorizedTaskId
            });

            using (new AssertionScope())
            {
                addAuthorizedTaskCommand.OutputToken.Should().Be(token);
                dbTask.Should().NotBeNull();
                dbTask.CreateDate.Should().NotBeDefault();
                dbTask.IPAddress.Address.Should().Be(TestIPAddresses.Localhost);
                dbTask.CompletedDate.Should().BeNull();
                dbTask.InvalidatedDate.Should().BeNull();
                dbTask.AuthorizationCode.Should().NotBeEmpty();
                dbTask.UserId.Should().BePositive();
                dbTask.AuthorizedTaskTypeCode.Should().Be(TestAuthorizedTaskType1.Code);
                dbTask.AuthorizedTaskId.Should().NotBeEmpty();
                dbTask.TaskData.Should().Be(uniqueData);
            }
        }