public void EditTest2() { // Arrange _clientConfiguration.Add("test", new FahClient(MockRepository.GenerateStub <IMessageConnection>()) { Settings = new ClientSettings { Name = "test", Server = "server", Port = 36330 } }); Assert.AreEqual(1, _clientConfiguration.Count); ConfigurationChangedEventArgs eventArgs = null; _clientConfiguration.DictionaryChanged += (sender, e) => { eventArgs = e; }; ClientEditedEventArgs editedEventArgs = null; _clientConfiguration.ClientEdited += (sender, e) => editedEventArgs = e; // Act _clientConfiguration.Edit("test", new ClientSettings { Name = "test2", Server = "server1", Port = 36331 }); // Assert Assert.AreEqual(1, _clientConfiguration.Count); Assert.IsTrue(_clientConfiguration.ContainsKey("test2")); Assert.AreEqual(ConfigurationChangedType.Edit, eventArgs.ChangedType); Assert.AreEqual("test2", eventArgs.Client.Settings.Name); Assert.AreEqual("server1-36331", eventArgs.Client.Settings.DataPath()); Assert.AreEqual("test", editedEventArgs.PreviousName); Assert.AreEqual("server-36330", editedEventArgs.PreviousPath); Assert.AreEqual("test2", editedEventArgs.NewName); Assert.AreEqual("server1-36331", editedEventArgs.NewPath); }
public void EditTest1() { // Arrange _clientConfiguration.Add("test", new LegacyClient { Settings = new ClientSettings(ClientType.Legacy) { Name = "test", Path = "/home/harlam357/" } }); Assert.AreEqual(1, _clientConfiguration.Count); ConfigurationChangedEventArgs eventArgs = null; _clientConfiguration.DictionaryChanged += (sender, e) => { eventArgs = e; }; ClientEditedEventArgs editedEventArgs = null; _clientConfiguration.ClientEdited += (sender, e) => editedEventArgs = e; // Act _clientConfiguration.Edit("test", new ClientSettings(ClientType.Legacy) { Name = "test2", Path = "/home/harlam357/FAH/" }); // Assert Assert.AreEqual(1, _clientConfiguration.Count); Assert.IsTrue(_clientConfiguration.ContainsKey("test2")); Assert.AreEqual(ConfigurationChangedType.Edit, eventArgs.ChangedType); Assert.AreEqual("test2", eventArgs.Client.Settings.Name); Assert.AreEqual("/home/harlam357/FAH/", eventArgs.Client.Settings.Path); Assert.AreEqual("test", editedEventArgs.PreviousName); Assert.AreEqual("/home/harlam357/", editedEventArgs.PreviousPath); Assert.AreEqual("test2", editedEventArgs.NewName); Assert.AreEqual("/home/harlam357/FAH/", editedEventArgs.NewPath); }
private static void UpdateBenchmarkData(IProteinBenchmarkCollection benchmarkCollection, ClientEditedEventArgs e) { // the name changed if (e.PreviousName != e.NewName) { // update the Names in the benchmark collection benchmarkCollection.UpdateOwnerName(e.PreviousName, e.PreviousPath, e.NewName); } // the path changed if (!Paths.Equal(e.PreviousPath, e.NewPath)) { // update the Paths in the benchmark collection benchmarkCollection.UpdateOwnerPath(e.NewName, e.PreviousPath, e.NewPath); } }
private void HandleClientEdit(object sender, ClientEditedEventArgs e) { // the name changed if (e.PreviousName != e.NewName) { // update the Names in the benchmark collection _benchmarkCollection.UpdateOwnerName(e.PreviousName, e.PreviousPath, e.NewName); } // the path changed if (!Paths.Equal(e.PreviousPath, e.NewPath)) { // update the Paths in the benchmark collection _benchmarkCollection.UpdateOwnerPath(e.NewName, e.PreviousPath, e.NewPath); } }