Example #1
0
        public void UpdateBrokerObjectTest()
        {
            var updateBrokerObjectRequest = new UpdateBrokerObjectRequest("brokerName", "objectName", new Dictionary <string, string>(), new HashSet <string>());
            var mockNetwork = new Mock <INetwork>(MockBehavior.Strict);

            mockNetwork
            .Setup(n => n.Invoke(updateBrokerObjectRequest))
            .Returns(new MockHttpWebResponse("SpectraLogic.SpectraRioBrokerClient.Test.TestFiles.UpdateBrokerObjectResponse",
                                             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 brokerObject = client.UpdateBrokerObject(updateBrokerObjectRequest);

            Assert.AreEqual("broker", brokerObject.Broker);
            Assert.AreEqual("5ac04144-bd37-4ee0-a661-09d4db08e9af", brokerObject.Name);
            Assert.AreEqual(1, brokerObject.Metadata.Count);
            Assert.AreEqual(1, brokerObject.Relationships.Count);
        }
Example #2
0
 /// <inheritdoc/>
 public IBrokerObject UpdateBrokerObject(UpdateBrokerObjectRequest request)
 {
     return(ExceptionDecorator.Run(() => new UpdateBrokerObjectResponseParser().Parse(_network.Invoke(request))));
 }