public void GetSourceReturnsServerSource() { IServerSource source = new SavedServerSource(new Server("4.3.2.1", 54321)); ServerSelectionItem item = new ServerSelectionItem(source); Assert.AreSame(source, item.GetSource()); }
public async Task GetServerReturnsServer() { Server server = new Server("1.2.3.4", 5678); SavedServerSource serverSource = new SavedServerSource(server); Assert.AreSame(server, await serverSource.GetServer(logger, clock, source)); }
public void ServerNameCanBeModified() { SavedServerSource serverSource = new SavedServerSource(new Server("1.2.3.4", 5678), "SERVER NAME"); serverSource.ServerName = "NEW NAME"; Assert.AreEqual("NEW NAME", serverSource.ServerName); }
public void AddressCanBeModified() { SavedServerSource serverSource = new SavedServerSource(new Server("1.2.3.4", 5678)); serverSource.Address = "8.7.6.5:4321"; Assert.AreEqual("8.7.6.5:4321", serverSource.Address); }
public void SaveReturnsASavedSource() { SavedServerSource serverSource = new SavedServerSource(new Server("1.2.3.4", 5678), "SERVER NAME"); SavedSource savedSource = serverSource.Save(); Assert.AreEqual("1.2.3.4:5678", savedSource.Address); Assert.AreEqual("SERVER NAME", savedSource.Name); Assert.IsNull(savedSource.Filename); }
public void CanBeConstructedFromASavedSource() { SavedSource savedSource = new SavedSource(); savedSource.Address = "1.2.3.4:5678"; savedSource.Name = "SERVER NAME"; SavedServerSource source = new SavedServerSource(savedSource); Assert.AreEqual("1.2.3.4:5678", source.Address); Assert.AreEqual("SERVER NAME", source.ServerName); }
private async Task SaveServer(Server server, string name) { for (int index = SAVED_SERVER_INDEX; index < SelectionCombo.Items.Count; index++) { ServerSelectionItem item = (ServerSelectionItem)SelectionCombo.Items[index]; SavedServerSource source = (SavedServerSource)item.GetSource(); if (server.Equals(await source.GetServer())) { source.ServerName = name; return; } } AddServer(server, name); }
public void ServerNameContainsTheKnownServerName() { SavedServerSource serverSource = new SavedServerSource(new Server("1.2.3.4", 5678), "SERVER NAME"); Assert.AreEqual("SERVER NAME", serverSource.ServerName); }
public void AddressContainsTheServerAddress() { SavedServerSource serverSource = new SavedServerSource(new Server("1.2.3.4", 5678)); Assert.AreEqual("1.2.3.4:5678", serverSource.Address); }
public void CreateWatcherReturnsNull() { SavedServerSource serverSource = new SavedServerSource(new Server("1.2.3.4", 5678)); Assert.IsNull(serverSource.CreateWatcher(() => { }, null)); }
public void GetDisplayNameReturnsServerNameAndAddressWhenNameIsKnown() { SavedServerSource serverSource = new SavedServerSource(new Server("1.2.3.4", 5678), "SERVER NAME"); Assert.AreEqual("SERVER NAME (1.2.3.4:5678)", serverSource.GetDisplayName()); }
public void GetDisplayNameReturnsServerAddressWhenServerNameIsUnknown() { SavedServerSource serverSource = new SavedServerSource(new Server("1.2.3.4", 5678)); Assert.AreEqual("1.2.3.4:5678", serverSource.GetDisplayName()); }
public async Task GetServerReturnsNullIfConstructedWithoutParameters() { SavedServerSource serverSource = new SavedServerSource(); Assert.IsNull(await serverSource.GetServer()); }