Exemplo n.º 1
0
 public void ConstructorTest()
 {
     using (var factory = new LivetubeClientFactory())
     {
         var livetube = factory.CreateLivetubeClient();
         var m        = livetube.GetType().GetField("_webClient", BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance);
         var t        = m.GetValue(livetube).GetType();
         Assert.AreEqual(typeof(WebClientWrapper), t);
     }
 }
Exemplo n.º 2
0
 public void ConstructorTest()
 {
     using (var factory = new LivetubeClientFactory())
     {
         var livetube = factory.CreateLivetubeClient();
         var m = livetube.GetType().GetField("_webClient", BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance);
         var t = m.GetValue(livetube).GetType();
         Assert.AreEqual(typeof(WebClientWrapper), t);
     }
 }
Exemplo n.º 3
0
        public void ConstructorTest2()
        {
            var mockFactory = new Mock<IWebClientFactory>();
            var mockWebClient = new Mock<IWebClient>();
            mockFactory.Setup(f => f.CreateWebClient()).Returns(mockWebClient.Object);

            using (var factory = new LivetubeClientFactory(mockFactory.Object))
            {
                var livetube = factory.CreateLivetubeClient();
                var m = livetube.GetType().GetField("_webClient", BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance);
                var t = m.GetValue(livetube).GetType();
                Assert.AreEqual(mockWebClient.Object.GetType(), t);
            }
        }
Exemplo n.º 4
0
        public void ConstructorTest2()
        {
            var mockFactory   = new Mock <IWebClientFactory>();
            var mockWebClient = new Mock <IWebClient>();

            mockFactory.Setup(f => f.CreateWebClient()).Returns(mockWebClient.Object);

            using (var factory = new LivetubeClientFactory(mockFactory.Object))
            {
                var livetube = factory.CreateLivetubeClient();
                var m        = livetube.GetType().GetField("_webClient", BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance);
                var t        = m.GetValue(livetube).GetType();
                Assert.AreEqual(mockWebClient.Object.GetType(), t);
            }
        }