Exemplo n.º 1
0
            protected override IDatabaseUser CreateCleanWithPositiveIdFrom(IDatabaseUser entity)
            {
                var te = new Ultrawave.Models.User(entity);

                te.Id = 1;
                return(User.Clean(te));
            }
Exemplo n.º 2
0
            protected override IObservable <IUser> CallUpdateEndpoint(ITogglApi api, IUser entityToUpdate)
            {
                var entityWithUpdates = new Ultrawave.Models.User(entityToUpdate);

                entityWithUpdates.Fullname = entityToUpdate.Fullname == "Test" ? "Different name" : "Test";

                return(api.User.Update(entityWithUpdates));
            }
Exemplo n.º 3
0
            public async Task DoesNotChangeDefaultWorkspaceWhenTheValueIsNull()
            {
                var(togglClient, user) = await SetupTestUser();

                var userWithUpdates = new Ultrawave.Models.User(user);

                userWithUpdates.DefaultWorkspaceId = null;

                var updatedUser = await togglClient.User.Update(userWithUpdates);

                updatedUser.Id.Should().Be(user.Id);
                updatedUser.DefaultWorkspaceId.Should().NotBeNull();
                updatedUser.DefaultWorkspaceId.Should().Be(user.DefaultWorkspaceId);
            }
Exemplo n.º 4
0
            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);
            }
Exemplo n.º 5
0
            public async Task ChangesDefaultWorkspace()
            {
                var(togglClient, user) = await SetupTestUser();

                var secondWorkspace = await togglClient.Workspaces.Create(new Workspace { Name = Guid.NewGuid().ToString() });

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