コード例 #1
0
        public void CheckIfWebClientWrapperIsOurFakeOne()
        {
            //Arrange
            var fakeWebClient = new Global.FakeWebClientWrapper();

            //Act
            var result1 = new WebClient(fakeWebClient);
            var result2 = new WebClient();

            //Assert
            Assert.That(result1.Wrapper, Is.EqualTo(fakeWebClient));
            Assert.That(result2.Wrapper.GetType().FullName, Is.EqualTo("Dev4s.WebClient.WebClientWrapper"));
        }
コード例 #2
0
        public void CheckIfWeCanChangeEncoding()
        {
            //Arrange
            var fakeWrapper = new Global.FakeWebClientWrapper();
            var webClient   = new WebClient(fakeWrapper);

            //Act
            var beforeChange = webClient.Encoding;

            webClient.Encoding = Encoding.ASCII;

            //Assert
            Assert.That(beforeChange, Is.Null);
            Assert.That(beforeChange, Is.Not.EqualTo(fakeWrapper.Encoding));
            Assert.That(webClient.Encoding, Is.EqualTo(Encoding.ASCII));
        }