Esempio n. 1
0
        public void SerializerFor_WithoutSerializerAdded_ReturnsFalse()
        {
            // Arrange
            var cache = new SerializerCache();

            // Act
            var hasSerializer = cache.SerializerFor("test", out var returnedSerializer);

            // Assert
            Assert.That(hasSerializer, Is.False);
            Assert.That(returnedSerializer, Is.Null);
        }
Esempio n. 2
0
        public void SetDefaultSerializer_WithSerializer_AddsToCache()
        {
            // Arrange
            var cache = new SerializerCache();

            // Act
            cache.SetDefaultSerializer(serializer);
            var hasSerializer = cache.SerializerFor(descriptor, out var returnedSerializer);

            // Assert
            Assert.That(hasSerializer, Is.True);
            Assert.That(returnedSerializer, Is.EqualTo(serializer));
        }
Esempio n. 3
0
        public void SerializerFor_WithSerializerAdded_ReturnsSameInstance()
        {
            // Arrange
            var cache = new SerializerCache();

            cache.AddSerializer(serializer);

            // Act
            var hasSerializer = cache.SerializerFor("test", out var returnedSerializer);

            // Assert
            Assert.That(returnedSerializer, Is.SameAs(serializer));
        }
Esempio n. 4
0
        public void SerializerFor_WithSerializerAdded_ReturnsTrue()
        {
            // Arrange
            var cache = new SerializerCache();

            cache.AddSerializer(serializer);

            // Act
            var hasSerializer = cache.SerializerFor("test", out var returnedSerializer);

            // Assert
            Assert.That(hasSerializer, Is.True);
        }