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(); }
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); }
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); }