public async Task ReadAsStringAsyncReturnsEmptyString() { var nullContent = new NullContent(); var result = await nullContent.ReadAsStringAsync(); Assert.Equal(string.Empty, result); }
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); }
// 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(); }
public void ContentLengthIsZero() { var nullContent = new NullContent(); Assert.Equal(0, nullContent.Headers.ContentLength); }
public void ContentRangeIsNull() { var nullContent = new NullContent(); Assert.Null(nullContent.Headers.ContentRange); }
public void ContentMD5IsNull() { var nullContent = new NullContent(); Assert.Null(nullContent.Headers.ContentMD5); }
public void ContentLanguageIsEmpty() { var nullContent = new NullContent(); Assert.Equal(0, nullContent.Headers.ContentLanguage.Count); }
public void ContentEncodingIsEmpty() { var nullContent = new NullContent(); Assert.Equal(0, nullContent.Headers.ContentEncoding.Count); }
public void AllowIsEmpty() { var nullContent = new NullContent(); Assert.Equal(0, nullContent.Headers.Allow.Count); }
public void ContentDispositionIsNull() { var nullContent = new NullContent(); Assert.Null(nullContent.Headers.ContentDisposition); }
private void Awake() { nullContent = new NullContent(); CellContent = nullContent; }