Exemple #1
0
        private async Task CreateClassroomAsync(HttpClient client)
        {
            const string ApiPath = "api/v1/classrooms";
            var          command = new CreateClassroomCommand(
                Guid.NewGuid(),
                Random.Next(Grade.Min, Grade.Max),
                Random.RandomString(3));

            var response = await client.PostAsync(ApiPath, command.ToJsonContent());

            response.EnsureSuccessStatusCode();
        }
Exemple #2
0
        protected async Task <CreateClassroomCommand> CreateClassroomAsync(HttpClient client)
        {
            var command = new CreateClassroomCommand(
                Guid.NewGuid(),
                Random.Next(Grade.Min, Grade.Max),
                Random.RandomString(3));

            var response = await client.PostAsync(ApiPath, command.ToJsonContent());

            response.EnsureSuccessStatusCode();

            return(command);
        }
Exemple #3
0
        private async Task <int> GetClassroomIdAsync(HttpClient client)
        {
            const string ApiPath = "api/v1/classrooms";

            var command = new CreateClassroomCommand(
                Guid.NewGuid(),
                Random.Next(Grade.Min, Grade.Max),
                Random.RandomString(3));
            var response = await client.PostAsync(ApiPath, command.ToJsonContent());

            response.EnsureSuccessStatusCode();

            response = await client.GetAsync(ApiPath);

            var list = await response.ReadAsync <IEnumerable <ClassroomReadModel> >();

            return(list.First().Id);
        }