public void TestSetNameSubsystemWorks() { var registry = new SendableRegistry(); var sendableMock = new Mock <ISendable>(); const string name = "mysendable"; const string subsystem = "subsystem"; registry.Add(sendableMock.Object, subsystem, name); Assert.True(registry.Contains(sendableMock.Object)); var storedName = registry.GetName(sendableMock.Object); Assert.Equal(name, storedName); var storedSubsystem = registry.GetSubsystem(sendableMock.Object); Assert.NotNull(storedSubsystem); Assert.Equal(subsystem, storedSubsystem); const string newName = "1234"; const string newSubsystem = "abc"; registry.SetName(sendableMock.Object, newSubsystem, newName); Assert.Equal($"{newName}", registry.GetName(sendableMock.Object)); Assert.Equal(newSubsystem, registry.GetSubsystem(sendableMock.Object)); }
public void TestSetNameModuleNumberWorks() { var registry = new SendableRegistry(); var sendableMock = new Mock <ISendable>(); const string name = "mysendable"; const int channel = 42; const int moduleNumber = 8; registry.Add(sendableMock.Object, name, moduleNumber, channel); Assert.True(registry.Contains(sendableMock.Object)); var storedName = registry.GetName(sendableMock.Object); Assert.Equal($"{name} [{moduleNumber},{channel}]", storedName); const string newName = "1234"; const int newChannel = 18; const int newModuleNumer = 56; registry.SetName(sendableMock.Object, newName, newModuleNumer, newChannel); Assert.Equal($"{newName} [{newModuleNumer},{newChannel}]", registry.GetName(sendableMock.Object)); }
public void TestSetNameNonExistantDoesNothing() { var registry = new SendableRegistry(); var sendableMock = new Mock <ISendable>(); const string name = "mysendable"; registry.SetName(sendableMock.Object, name); var storedName = registry.GetName(sendableMock.Object); Assert.Equal(string.Empty, storedName); }
public void TestSetNameStockWorks() { var registry = new SendableRegistry(); var sendableMock = new Mock <ISendable>(); const string name = "mysendable"; registry.Add(sendableMock.Object, name); Assert.True(registry.Contains(sendableMock.Object)); var storedName = registry.GetName(sendableMock.Object); Assert.NotNull(storedName); Assert.Equal(name, storedName); const string newName = "1234"; registry.SetName(sendableMock.Object, newName); Assert.Equal(newName, registry.GetName(sendableMock.Object)); }
public void TestAddWithChannelAddsCorrectly() { var registry = new SendableRegistry(); var sendableMock = new Mock <ISendable>(); const string name = "mysendable"; const int channel = 42; registry.Add(sendableMock.Object, name, channel); Assert.True(registry.Contains(sendableMock.Object)); var storedName = registry.GetName(sendableMock.Object); Assert.Equal($"{name} [{channel}]", storedName); }
public void TestAddLWAddsCorrectly() { var registry = new SendableRegistry(); var sendableMock = new Mock <ISendable>(); const string name = "mysendable"; registry.AddLW(sendableMock.Object, name); Assert.True(registry.Contains(sendableMock.Object)); var storedName = registry.GetName(sendableMock.Object); Assert.NotNull(storedName); Assert.Equal(name, storedName); }
public void TestRemovesCorrectly() { var registry = new SendableRegistry(); var sendableMock = new Mock <ISendable>(); const string name = "mysendable"; registry.Add(sendableMock.Object, name); Assert.True(registry.Contains(sendableMock.Object)); Assert.True(registry.Remove(sendableMock.Object)); Assert.False(registry.Contains(sendableMock.Object)); Assert.Empty(registry.GetName(sendableMock.Object)); }
public void TestAddWithSubsystemAddsCorrectly() { var registry = new SendableRegistry(); var sendableMock = new Mock <ISendable>(); const string name = "mysendable"; const string subsystem = "subsystem"; registry.Add(sendableMock.Object, subsystem, name); Assert.True(registry.Contains(sendableMock.Object)); var storedName = registry.GetName(sendableMock.Object); Assert.Equal(name, storedName); var storedSubsystem = registry.GetSubsystem(sendableMock.Object); Assert.NotNull(storedSubsystem); Assert.Equal(subsystem, storedSubsystem); }