public void GetSpectraDeviceTest() { var getSpectraDeviceRequest = new GetSpectraDeviceRequest("device_test"); var mockNetwork = new Mock <INetwork>(MockBehavior.Strict); mockNetwork .Setup(n => n.Invoke(getSpectraDeviceRequest)) .Returns(new MockHttpWebResponse("SpectraLogic.SpectraRioBrokerClient.Test.TestFiles.GetSpectraDeviceResponse", HttpStatusCode.OK, null)); var mockBuilder = new Mock <ISpectraRioBrokerClientBuilder>(MockBehavior.Strict); mockBuilder .Setup(b => b.Build()) .Returns(new SpectraRioBrokerClient(mockNetwork.Object)); var builder = mockBuilder.Object; var client = builder.Build(); var device = client.GetSpectraDevice(getSpectraDeviceRequest); Assert.AreEqual("device_test", device.DeviceName); Assert.AreEqual("https://localhost".ToUri(), device.MgmtInterface); Assert.AreEqual("username", device.Username); mockBuilder.VerifyAll(); mockNetwork.VerifyAll(); }
/// <inheritdoc/> public ISpectraDevice GetSpectraDevice(GetSpectraDeviceRequest request) { return(ExceptionDecorator.Run(() => new GetSpectraDeviceResponseParser().Parse(_network.Invoke(request)))); }