public async Task ReturnsCreatedWorkspace() { var(togglClient, user) = await SetupTestUser(); var secondWorkspace = await WorkspaceHelper.CreateFor(user); var workspace = await CallEndpointWith(togglClient, secondWorkspace.Id); workspace.Id.Should().Be(secondWorkspace.Id); workspace.Name.Should().Be(secondWorkspace.Name); }
public async Task ReturnsAllWorkspaces() { var(togglClient, user) = await SetupTestUser(); var secondWorkspace = await WorkspaceHelper.CreateFor(user); var workspaces = await CallEndpointWith(togglClient); workspaces.Should().HaveCount(2); workspaces.Should().Contain(ws => ws.Id == user.DefaultWorkspaceId); workspaces.Should().Contain(ws => ws.Id == secondWorkspace.Id); }
public async Task ReturnsAllWorkspaceFeaturesForMultipleWorkspaces() { var(togglClient, user) = await SetupTestUser(); var anotherWorkspace = await WorkspaceHelper.CreateFor(user); var workspaceFeatureCollection = await CallEndpointWith(togglClient); workspaceFeatureCollection.Should().HaveCount(2); workspaceFeatureCollection.Should().Contain(collection => collection.WorkspaceId == user.DefaultWorkspaceId); workspaceFeatureCollection.Should().Contain(collection => collection.WorkspaceId == anotherWorkspace.Id); }
public async ThreadingTask DoesNotFindProjectInADifferentWorkspace() { var(togglApi, user) = await SetupTestUser(); var secondWorkspace = await WorkspaceHelper.CreateFor(user); var projectA = await togglApi.Projects.Create(new Project { Name = Guid.NewGuid().ToString(), WorkspaceId = secondWorkspace.Id }); var projectB = await togglApi.Projects.Create(new Project { Name = Guid.NewGuid().ToString(), WorkspaceId = secondWorkspace.Id }); var projects = await togglApi.Projects.Search(user.DefaultWorkspaceId, new[] { projectA.Id, projectB.Id }); projects.Should().HaveCount(0); }
public async ThreadingTask ReturnsOnlyProjectInTheSearchedWorkspace() { var(togglApi, user) = await SetupTestUser(); var secondWorkspace = await WorkspaceHelper.CreateFor(user); var projectA = await togglApi.Projects.Create(new Project { Name = Guid.NewGuid().ToString(), WorkspaceId = user.DefaultWorkspaceId }); var projectB = await togglApi.Projects.Create(new Project { Name = Guid.NewGuid().ToString(), WorkspaceId = secondWorkspace.Id }); var projects = await togglApi.Projects.Search(user.DefaultWorkspaceId, new[] { projectA.Id, projectB.Id }); projects.Should().HaveCount(1); projects.Should().Contain(p => p.Id == projectA.Id); }
public async Task ReturnsTagsForAllWorkspaces() { var(togglApi, user) = await SetupTestUser(); var otherWorkspace = await WorkspaceHelper.CreateFor(user); await pushTags(togglApi, tags1, user.DefaultWorkspaceId); await pushTags(togglApi, tags2, otherWorkspace.Id); var returnedTags = await CallEndpointWith(togglApi); returnedTags.Should().HaveCount(tags1.Length + tags2.Length); assertTags(returnedTags, tags1, user.DefaultWorkspaceId); assertTags(returnedTags, tags2, otherWorkspace.Id); }
public async Task ChangesDefaultWorkspace() { var(togglClient, user) = await SetupTestUser(); var secondWorkspace = await WorkspaceHelper.CreateFor(user); var userWithUpdates = new Ultrawave.Models.User(user); userWithUpdates.DefaultWorkspaceId = secondWorkspace.Id; var updatedUser = await togglClient.User.Update(userWithUpdates); updatedUser.Id.Should().Be(user.Id); updatedUser.DefaultWorkspaceId.Should().NotBe(user.DefaultWorkspaceId); updatedUser.DefaultWorkspaceId.Should().Be(secondWorkspace.Id); }
public async System.Threading.Tasks.Task ReturnsTagsForAllWorkspaces() { var(togglApi, user) = await SetupTestUser(); var otherWorkspace = await WorkspaceHelper.CreateFor(user); var timeEntry1 = createTimeEntry(user.Id, user.DefaultWorkspaceId, tags1); var timeEntry2 = createTimeEntry(user.Id, otherWorkspace.Id, tags2); await togglApi.TimeEntries.Create(timeEntry1); await togglApi.TimeEntries.Create(timeEntry2); var returnedTags = await CallEndpointWith(togglApi); returnedTags.Should().HaveCount(tags1.Length + tags2.Length); assertTags(returnedTags, tags1, user.DefaultWorkspaceId); assertTags(returnedTags, tags2, otherWorkspace.Id); }