public void WhenProjectIdDoesNotExist_GetZoneSettingsThrowsKeyNotFoundException() { var baseKey = hkcu.CreateSubKey(TestKeyPath); var repository = new ConnectionSettingsRepository(baseKey); Assert.Throws <KeyNotFoundException>(() => { repository.GetZoneSettings("nonexisting-project", "zone-id"); }); }
public void WhenZoneIdDoesNotExist_GetZoneSettingsReturnsDefaults() { var baseKey = hkcu.CreateSubKey(TestKeyPath); var repository = new ConnectionSettingsRepository(baseKey); repository.SetProjectSettings(new ProjectConnectionSettings() { ProjectId = "pro-1" }); var settings = repository.GetZoneSettings("pro-1", "some-zone"); Assert.AreEqual("some-zone", settings.ZoneId); }
public void WhenSetValidZoneSettings_GetZoneSettingsReturnSameValues() { var baseKey = hkcu.CreateSubKey(TestKeyPath); var repository = new ConnectionSettingsRepository(baseKey); repository.SetProjectSettings(new ProjectConnectionSettings() { ProjectId = "pro-1" }); repository.SetZoneSettings("pro-1", new ZoneConnectionSettings() { ZoneId = "zone-1", Username = "******" }); Assert.AreEqual("user-1", repository.GetZoneSettings("pro-1", "zone-1").Username); }
public void WhenProjectSettingsDeleted_ZoneSettingsAreDeletedToo() { var baseKey = hkcu.CreateSubKey(TestKeyPath); var repository = new ConnectionSettingsRepository(baseKey); repository.SetProjectSettings(new ProjectConnectionSettings() { ProjectId = "pro-1" }); repository.SetZoneSettings("pro-1", new ZoneConnectionSettings() { ZoneId = "zone-1", Username = "******" }); repository.DeleteProjectSettings("pro-1"); Assert.Throws <KeyNotFoundException>(() => { repository.GetZoneSettings("pro-1", "zone-1"); }); }