Пример #1
0
 public Server(string name, IUri uri, IRestConsumer restConsumer)
 {
     this.UniqueId     = Guid.NewGuid();
     this.Name         = name;
     this.Uri          = uri;
     this.RestConsumer = restConsumer;
 }
        public void SetUp()
        {
            this.restConfigurations = new List <IRestConfiguration>();
            this.mockWrapperFactory = A.Fake <IWrapperFactory>();
            this.mockNetworkFactory = A.Fake <INetworkFactory>();

            this.configuration1 = A.Fake <IRestConfiguration>();
            A.CallTo(() => this.configuration1.BaseUrl).Returns("url1");
            A.CallTo(() => this.configuration1.UserName).Returns("user1");
            A.CallTo(() => this.configuration1.Password).Returns("password1");
            A.CallTo(() => this.configuration1.IsServerOn).Returns(true);
            A.CallTo(() => this.configuration1.Name).Returns("conf1");
            restConfigurations.Add(this.configuration1);


            this.configuration2 = A.Fake <IRestConfiguration>();
            A.CallTo(() => this.configuration2.BaseUrl).Returns("url2");
            A.CallTo(() => this.configuration2.UserName).Returns("user2");
            A.CallTo(() => this.configuration2.Password).Returns("password2");
            A.CallTo(() => this.configuration2.IsServerOn).Returns(true);
            A.CallTo(() => this.configuration2.Name).Returns("conf2");
            restConfigurations.Add(this.configuration2);

            this.mockHttpClientHandler = A.Fake <IHttpClient>();
            this.mockRestConsumer      = A.Fake <IRestConsumer>();

            A.CallTo(() => this.mockWrapperFactory.CreateHttpClientHandler(this.configuration1.UserName, this.configuration1.Password)).Returns(mockHttpClientHandler);
            A.CallTo(() => this.mockNetworkFactory.CreateRestConsumer(A <IUri> .Ignored, mockHttpClientHandler, mockWrapperFactory)).Returns(mockRestConsumer);

            this.testee = new RestFactory(this.restConfigurations, this.mockWrapperFactory, mockNetworkFactory);
        }
Пример #3
0
 public Server(string name, IUri uri, IRestConsumer restConsumer)
 {
     this.UniqueId = Guid.NewGuid();
     this.Name = name;
     this.Uri = uri;
     this.RestConsumer = restConsumer;
 }
Пример #4
0
        public void SetUp()
        {
            this.mockUri = A.Fake <IUri>();

            this.mockRestConsumer = A.Fake <IRestConsumer>();

            this.testee = new Server("servername", this.mockUri, mockRestConsumer);
        }
        public void SetUp()
        {
            this.mockUri = A.Fake<IUri>();

            this.mockRestConsumer = A.Fake<IRestConsumer>();

            this.testee = new Server("servername", this.mockUri, mockRestConsumer);
        }
 public IUpdater CreateUpdater(IRestConsumer restConsumer)
 {
     return new Updater(restConsumer);
 }
Пример #7
0
 public Updater(IRestConsumer restConsumer)
 {
     this.restConsumer = restConsumer;
     this.restObjectsToUpdate = new List<IRestObject>();
 }
Пример #8
0
 public Updater(IRestConsumer restConsumer)
 {
     this.restConsumer        = restConsumer;
     this.restObjectsToUpdate = new List <IRestObject>();
 }
 public IUpdater CreateUpdater(IRestConsumer restConsumer)
 {
     return(new Updater(restConsumer));
 }
        public void SetUp()
        {
            this.restConfigurations = new List<IRestConfiguration>();
            this.mockWrapperFactory = A.Fake<IWrapperFactory>();
            this.mockNetworkFactory = A.Fake<INetworkFactory>();

            this.configuration1 = A.Fake<IRestConfiguration>();
            A.CallTo(() => this.configuration1.BaseUrl).Returns("url1");
            A.CallTo(() => this.configuration1.UserName).Returns("user1");
            A.CallTo(() => this.configuration1.Password).Returns("password1");
            A.CallTo(() => this.configuration1.IsServerOn).Returns(true);
            A.CallTo(() => this.configuration1.Name).Returns("conf1");
            restConfigurations.Add(this.configuration1);

            this.configuration2 = A.Fake<IRestConfiguration>();
            A.CallTo(() => this.configuration2.BaseUrl).Returns("url2");
            A.CallTo(() => this.configuration2.UserName).Returns("user2");
            A.CallTo(() => this.configuration2.Password).Returns("password2");
            A.CallTo(() => this.configuration2.IsServerOn).Returns(true);
            A.CallTo(() => this.configuration2.Name).Returns("conf2");
            restConfigurations.Add(this.configuration2);

            this.mockHttpClientHandler = A.Fake<IHttpClient>();
            this.mockRestConsumer = A.Fake<IRestConsumer>();

            A.CallTo(() => this.mockWrapperFactory.CreateHttpClientHandler(this.configuration1.UserName, this.configuration1.Password)).Returns(mockHttpClientHandler);
            A.CallTo(() => this.mockNetworkFactory.CreateRestConsumer(A<IUri>.Ignored, mockHttpClientHandler, mockWrapperFactory)).Returns(mockRestConsumer);

            this.testee = new RestFactory(this.restConfigurations, this.mockWrapperFactory, mockNetworkFactory);
        }