public async Task WhenProjectsAddedTwice_ListProjectsReturnsProjectOnce() { await repository.AddProjectAsync("test-123"); await repository.AddProjectAsync("test-123"); var projects = this.repository.ListProjectsAsync().Result; Assert.AreEqual(1, projects.Count()); Assert.AreEqual("test-123", projects.First().ProjectId); }
public async void AddProject_saveChangesInDatabaseAsync() { var project = GetProject(); Assert.Equal(0, project.ID); await _projectRepository.AddProjectAsync(project); Assert.NotEqual(0, project.ID); Project savedProject = await _projectRepository.GetProjectByIdAsync(project.ID); Assert.NotNull(savedProject); Assert.Equal("Test name", savedProject.Name); Assert.Equal("Test description", savedProject.Description); }
public void SetUp() { hkcu.DeleteSubKeyTree(TestKeyPath, false); var projectRepository = new ProjectRepository( hkcu.CreateSubKey(TestKeyPath), new Mock <IEventService>().Object); var settingsRepository = new ConnectionSettingsRepository(projectRepository); this.service = new ConnectionSettingsService(settingsRepository); // Set some initial project settings. projectRepository.AddProjectAsync(SampleProjectId).Wait(); var projectSettings = settingsRepository.GetProjectSettings(SampleProjectId); projectSettings.RdpDomain.Value = "project-domain"; settingsRepository.SetProjectSettings(projectSettings); }