public void NetConnectorFactory_CreateWithValidBaseAddress_ShouldReturnValidObject(string baseAddress) { var connectorFactory = new NetConnectorFactory(); var connector = connectorFactory.Create(baseAddress); Assert.IsNotNull(connector, "Connector should be a valid object."); Assert.IsInstanceOf <INetConnector>(connector, "Connector should be a instance of {0}.", nameof(INetConnector)); }
public void NetConnectorFactory_ParameterlessCreate_ShouldReturnValidObject() { var connectorFactory = new NetConnectorFactory(); var connector = connectorFactory.Create(); Assert.IsNotNull(connector, "Connector should be a valid object."); Assert.IsInstanceOf <INetConnector>(connector, "Connector should be a instance of {0}.", nameof(INetConnector)); }
public void NetConnectorFactory_CreateWithInvalidBaseAddress_ShouldThrowUriFormatException(string baseAddress) { Assert.Catch <UriFormatException>( () => { var connectorFactory = new NetConnectorFactory(); var connector = connectorFactory.Create(baseAddress); }, "Constructor should throw UriFormatException"); }
public void NetConnectorFactory_CreateWithNullOrWhiteSpaceBaseAddress_ShouldThrowArgumentNullException(string baseAddress) { Assert.Catch <ArgumentNullException>( () => { var connectorFactory = new NetConnectorFactory(); var connector = connectorFactory.Create(baseAddress); }, "Constructor With Null BaseAddress should throw {0}", nameof(ArgumentNullException)); }
public void NetConnectorFactory_CreateWithNullOrWhiteSpaceBaseAddress_ShouldThrowArgumentNullExceptionWithCorrectParamName(string baseAddress) { try { var connectorFactory = new NetConnectorFactory(); var connector = connectorFactory.Create(baseAddress); } catch (ArgumentNullException e) { Assert.AreEqual("BaseAddress", e.ParamName, "ParamName should be BaseAddress"); } }