Пример #1
0
        public void AddLocationHeaderToMapping_DoesNotAddContentIdToLocationMapping_IfLocationIsNull()
        {
            // Arrange
            var response = new HttpResponseMessage();
            var contentIdToLocationMapping = new Dictionary <string, string>();
            var contentId = Guid.NewGuid().ToString();

            // Act
            ContentIdHelpers.AddLocationHeaderToMapping(response, contentIdToLocationMapping, contentId);

            // Assert
            Assert.False(contentIdToLocationMapping.ContainsKey(contentId));
        }
Пример #2
0
        public void AddLocationHeaderToMapping_AddsContentIdToLocationMapping()
        {
            // Arrange
            var response = new HttpResponseMessage();

            response.Headers.Location = new Uri("http://any");
            var contentIdToLocationMapping = new Dictionary <string, string>();
            var contentId = Guid.NewGuid().ToString();

            // Act
            ContentIdHelpers.AddLocationHeaderToMapping(response, contentIdToLocationMapping, contentId);

            // Assert
            Assert.True(contentIdToLocationMapping.ContainsKey(contentId));
            Assert.Equal(response.Headers.Location.AbsoluteUri, contentIdToLocationMapping[contentId]);
        }