public void ShouldReviveMultipleServerDatabasePairs() { string argument = "server1|database1,server2|database1,server2|database2"; var expected = new[] { new DatabaseEndpoint() { ServerName = "server1", DatabaseName = "database1" }, new DatabaseEndpoint() { ServerName = "server2", DatabaseName = "database1" }, new DatabaseEndpoint() { ServerName = "server2", DatabaseName = "database2" }, }; var actual = DatabaseEndpointArgReviver.Revive(string.Empty, argument); Assert.IsNotNull(actual); Assert.IsNotNull(actual.Endpoints); Assert.IsTrue(actual.Endpoints.Length == 3); for (int i = 0; i < expected.Length; i++) { Assert.AreEqual(expected[i].ServerName, actual.Endpoints[i].ServerName); Assert.AreEqual(expected[i].DatabaseName, actual.Endpoints[i].DatabaseName); } }
public void ShouldReturnAnEmptyArrayForNullOrEmptyArgumentStrings() { var actual = DatabaseEndpointArgReviver.Revive(string.Empty, null); Assert.IsTrue(actual.Endpoints.Length == 0); actual = DatabaseEndpointArgReviver.Revive(string.Empty, string.Empty); Assert.IsTrue(actual.Endpoints.Length == 0); }
public void ShouldReviveSingleServerDatabasePair() { string argument = "server1|database1"; var expected = new[] { new DatabaseEndpoint() { ServerName = "server1", DatabaseName = "database1" } }; var actual = DatabaseEndpointArgReviver.Revive(string.Empty, argument); Assert.IsNotNull(actual); Assert.IsNotNull(actual.Endpoints); Assert.IsTrue(actual.Endpoints.Length == 1); Assert.AreEqual(expected[0].ServerName, actual.Endpoints[0].ServerName); Assert.AreEqual(expected[0].DatabaseName, actual.Endpoints[0].DatabaseName); }
public void ShouldReturnAnEmptyArrayForArgumentsWithNoPairSeperator() { var actual = DatabaseEndpointArgReviver.Revive(string.Empty, "servername,database"); Assert.IsTrue(actual.Endpoints.Length == 0); }
public void ShouldThrowArgumentExceptionForMissingPairParts() { var actual = DatabaseEndpointArgReviver.Revive(string.Empty, "servername|"); }