Example #1
0
        public void CanRead_GivenCorrectContentType_ExpectTrue()
        {
            var cspReportBodyFormatter = new CspReportBodyFormatter();
            var httpContext            = new DefaultHttpContext();

            httpContext.Request.ContentType = "application/csp-report";
            Assert.True(cspReportBodyFormatter.CanRead(CreateInputFormatterContext(typeof(CspPost), httpContext)));
        }
Example #2
0
        public void CanRead_GivenWrongContentTypeNull_ExpectFasle()
        {
            var cspReportBodyFormatter = new CspReportBodyFormatter();
            var httpContext            = new DefaultHttpContext();

            httpContext.Request.ContentType = string.Empty;
            Assert.False(
                cspReportBodyFormatter.CanRead(CreateInputFormatterContext(typeof(CspPost), httpContext)));
        }
Example #3
0
        public void CanRead_GivenContextIsNull_ExpectException()
        {
            var cspReportBodyFormatter = new CspReportBodyFormatter();

            Assert.Throws <ArgumentNullException>(() => cspReportBodyFormatter.CanRead(null));
        }