Esempio n. 1
0
        public async Task ReadAsStringAsyncReturnsEmptyString()
        {
            var nullContent = new NullContent();
            var result      = await nullContent.ReadAsStringAsync();

            Assert.Equal(string.Empty, result);
        }
Esempio n. 2
0
        private HttpContent CreateHttpContent(RestRequest restRequest)
        {
            if (restRequest.Method != HttpMethod.Post && restRequest.Method != HttpMethod.Put)
            {
                return(null);
            }

            HttpContent httpContent;

            switch (restRequest.ContentType)
            {
            case RestContentType.Json:
                var json = this.Serializer.Serialize(restRequest.Content);
                httpContent = new StringContent(json, restRequest.ContentEncoding, "application/json");
                if (restRequest.ContentEncoding == null)
                {
                    httpContent.Headers.ContentType.CharSet = null;
                }
                httpContent.Headers.ContentLength = json.Length;
                break;

            case RestContentType.FormUrlEncoded:
                httpContent = new CustomFormUrlEncodedContent(restRequest.Content);
                break;

            default:
                httpContent = new NullContent();
                break;
            }
            if (httpContent.Headers.ContentLength == null)
            {
                httpContent.Headers.ContentLength = 0;
            }
            return(httpContent);
        }
        public IEnumerator ContentProvider_WhenGivenNullContent_Exits()
        {
            var content = new NullContent();

            LogAssert.Expect(LogType.Error, "SelectionUtilityTests.NullContent: Releasing content named 'Null' because it returned null value.");
            SelectionUtility.ShowInWindow(content);
            for (var i = 0; i < 10; ++i)
            {
                yield return(null);
            }
            Assert.That(Resources.FindObjectsOfTypeAll <ContentWindow>().Any(), Is.False);
        }
Esempio n. 4
0
 // The empty constructor should not call the base constructor
 // Otherwise the document will be initialized after empty construction and the factory will initialize it again
 public TestDocument()
 {
     Metadata        = new TestMetadata();
     ContentProvider = new NullContent();
 }
Esempio n. 5
0
        public void ContentLengthIsZero()
        {
            var nullContent = new NullContent();

            Assert.Equal(0, nullContent.Headers.ContentLength);
        }
Esempio n. 6
0
        public void ContentRangeIsNull()
        {
            var nullContent = new NullContent();

            Assert.Null(nullContent.Headers.ContentRange);
        }
Esempio n. 7
0
        public void ContentMD5IsNull()
        {
            var nullContent = new NullContent();

            Assert.Null(nullContent.Headers.ContentMD5);
        }
Esempio n. 8
0
        public void ContentLanguageIsEmpty()
        {
            var nullContent = new NullContent();

            Assert.Equal(0, nullContent.Headers.ContentLanguage.Count);
        }
Esempio n. 9
0
        public void ContentEncodingIsEmpty()
        {
            var nullContent = new NullContent();

            Assert.Equal(0, nullContent.Headers.ContentEncoding.Count);
        }
Esempio n. 10
0
        public void AllowIsEmpty()
        {
            var nullContent = new NullContent();

            Assert.Equal(0, nullContent.Headers.Allow.Count);
        }
Esempio n. 11
0
        public void ContentDispositionIsNull()
        {
            var nullContent = new NullContent();

            Assert.Null(nullContent.Headers.ContentDisposition);
        }
Esempio n. 12
0
 private void Awake()
 {
     nullContent = new NullContent();
     CellContent = nullContent;
 }