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 TestSetSubsystem() { 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.Equal("Ungrouped", registry.GetSubsystem(sendableMock.Object)); const string subsystem = "subsystem"; registry.SetSubsystem(sendableMock.Object, subsystem); Assert.Equal(subsystem, registry.GetSubsystem(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); }