public void ShouldThrowIfTypeIsExcluded() { var serializationConstraints = new MicrodotSerializationConstraints( () => new MicrodotSerializationSecurityConfig { DeserializationForbiddenTypes = new[] { "foo" }.ToList() } ); Assert.Throws <UnauthorizedAccessException>(() => serializationConstraints.ThrowIfExcluded("foo")); Assert.Throws <UnauthorizedAccessException>(() => serializationConstraints.ThrowIfExcluded("barfoobuzz")); Assert.Throws <UnauthorizedAccessException>(() => serializationConstraints.ThrowIfExcluded("barfOobuzz")); }
public void ShouldNotThrowIfTypeIsNotExcluded() { var serializationConstraints = new MicrodotSerializationConstraints( () => new MicrodotSerializationSecurityConfig { DeserializationForbiddenTypes = new[] { "foo" }.ToList() }); Assert.DoesNotThrow(() => serializationConstraints.ThrowIfExcluded("bar")); }