public void ShouldWriteAtomContentTypeHeaderToResponse()
        {
            string fileName = @"..\..\Data\productcatalog\current.atom";

            IRepresentation representation = new FileBasedAtomDocument(fileName, new SendChunked(true));

            Output output = Output.For(representation);

            Assert.AreEqual("application/atom+xml", output.ContentType);
        }
        public void WhenSendChunkedIsTrueShouldNotWriteLengthHeaderToResponse()
        {
            string fileName = @"..\..\Data\productcatalog\current.atom";

            IRepresentation representation = new FileBasedAtomDocument(fileName, new SendChunked(true));

            Output output = Output.For(representation);

            Assert.IsNull(output.ContentLength);
            Assert.IsTrue(output.IsChunked.Value);
        }
        public void ShouldWriteLastUpdatedDateTimeToResponse()
        {
            string fileName = @"..\..\Data\productcatalog\current.atom";

            IRepresentation representation = new FileBasedAtomDocument(fileName, new SendChunked(true));

            Output output = Output.For(representation);

            FileInfo fileInfo = new FileInfo(fileName);

            Assert.AreEqual(fileInfo.LastWriteTimeUtc.ToString("R"), output.LastModified);
        }
        public void WhenSendChunkedIsFalseShouldWriteLengthHeaderToResponse()
        {
            string fileName = @"..\..\Data\productcatalog\current.atom";

            IRepresentation representation = new FileBasedAtomDocument(fileName, new SendChunked(false));

            Output output = Output.For(representation);

            FileInfo fileInfo = new FileInfo(fileName);

            Assert.AreEqual(fileInfo.Length, output.ContentLength);
            Assert.IsFalse(output.IsChunked.Value);
        }
        public void ShouldWriteETagHeaderToResponse()
        {
            string fileName = @"..\..\Data\productcatalog\current.atom";

            IRepresentation representation = new FileBasedAtomDocument(fileName, new SendChunked(true));

            Output output = Output.For(representation);

            FileInfo fileInfo = new FileInfo(fileName);
            string expectedETag = string.Format(@"""current.atom#{0}""", fileInfo.LastWriteTimeUtc.Ticks);

            Assert.AreEqual(expectedETag, output.ETag);
        }