public GetStorageDispatcherTest()
        {
            _dispatcherMock = new Mock <IDispatcher>();
            _optionsMock    = new Mock <IOptions <StorageServiceEndPointConstants> >();

            _optionsMock.Setup(t => t.Value).Returns(new StorageServiceEndPointConstants
            {
                Get = "http://storage.librayos.io/api/storage"
            });

            _dispatcherMock.Setup(s => s.Dispatch <object, StorageServiceResponse>(
                                      null, It.IsAny <string>(), null, HttpRequestCode.GET
                                      , It.IsAny <Dictionary <string, object> >(), null))
            .Returns(() =>
                     new StorageServiceResponse()
            {
                Total = 1, StorageCollection = new List <StorageModel>()
                {
                    new StorageModel()
                    {
                        Id           = "id", Name = "name"
                        , RackNumber = null
                    }
                }
            });
            _sut = new StorageServiceDispatcher(_dispatcherMock.Object, _optionsMock.Object);
        }
Exemplo n.º 2
0
        public DeleteStorageDispatcherTest()
        {
            _dispatcherMock = new Mock <IDispatcher>();
            _optionsMock    = new Mock <IOptions <StorageServiceEndPointConstants> >();

            _optionsMock.Setup(t => t.Value).Returns(new StorageServiceEndPointConstants
            {
                Delete = "http://storage.librayos.io/api/storage"
            });

            _dispatcherMock
            .Setup(s => s.Dispatch <object, object>(It.IsAny <object>(), It.IsAny <string>(), null, HttpRequestCode.DELETE
                                                    , null, null)).Verifiable();

            _sut = new StorageServiceDispatcher(_dispatcherMock.Object, _optionsMock.Object);
        }