示例#1
0
 protected override IObservable <IClient> CallEndpointWith(ITogglApi togglApi)
 => Observable.Defer(async() =>
 {
     var user   = await togglApi.User.Get();
     var client = new Client {
         Name = Guid.NewGuid().ToString(), WorkspaceId = user.DefaultWorkspaceId.Value
     };
     return(CallEndpointWith(togglApi, client));
 });
示例#2
0
            protected override async Task <IClient> CallEndpointWith(ITogglApi togglApi)
            {
                var user = await togglApi.User.Get();

                var client = new Client {
                    Name = Guid.NewGuid().ToString(), WorkspaceId = user.DefaultWorkspaceId.Value
                };

                return(await CallEndpointWith(togglApi, client));
            }
示例#3
0
            public async Task CreatesNewClient()
            {
                var(togglClient, user) = await SetupTestUser();

                var newClient = new Client {
                    Name = Guid.NewGuid().ToString(), WorkspaceId = user.DefaultWorkspaceId.Value
                };

                var persistedClient = await CallEndpointWith(togglClient, newClient);

                persistedClient.Name.Should().Be(newClient.Name);
                persistedClient.WorkspaceId.Should().Be(newClient.WorkspaceId);
            }
示例#4
0
            public async Task ReturnsAllClients()
            {
                var(togglClient, user) = await SetupTestUser();

                var firstClient = new Client {
                    Name = "First", WorkspaceId = user.DefaultWorkspaceId.Value
                };
                var firstClientPosted = await togglClient.Clients.Create(firstClient);

                var secondClient = new Client {
                    Name = "Second", WorkspaceId = user.DefaultWorkspaceId.Value
                };
                var secondClientPosted = await togglClient.Clients.Create(secondClient);

                var clients = await CallEndpointWith(togglClient);

                clients.Should().HaveCount(2);
                clients.Should().Contain(clientWithSameIdNameAndWorkspaceAs(firstClientPosted));
                clients.Should().Contain(clientWithSameIdNameAndWorkspaceAs(secondClientPosted));
            }