Пример #1
0
            public void Throw_error_when_encoding_is_invalid()
            {
                // Arrange
                var item = new File(AnyPath, AnyHash, AnySize, "abc123", (ContentEncoding) 123);

                // Act & Assert
                Assert.That(() => item.ReadAsByteArray(), Throws.TypeOf<InvalidOperationException>());
            }
Пример #2
0
            public void Return_empty_byte_array_when_content_is_null()
            {
                // Arrange
                var item = new File(AnyPath, AnyHash, AnySize, null, ContentEncoding.Utf8);

                // Act
                var bytes = item.ReadAsByteArray();

                // Assert
                Assert.That(bytes, Is.Empty);
            }
Пример #3
0
            public void Read_utf8_content()
            {
                // Arrange
                var item = new File(AnyPath, AnyHash, AnySize, "abc123", ContentEncoding.Utf8);

                // Act
                var bytes = item.ReadAsByteArray();

                // Assert
                Assert.That(bytes, Is.EqualTo(Encoding.UTF8.GetBytes("abc123")));
            }