public void CreateLazy_ShouldBuildOnFirstCall() { var builder = new DeserializerBuilder(_policy); Assert.Null(LazyDeserializeMethodCache <LazyPrimitive> .Builder); // ensure nothing is set yet var storage = DeserializerStorageProvider.CreateLazy <LazyPrimitive>(); Assert.NotNull(LazyDeserializeMethodCache <LazyPrimitive> .Builder); // should be set now Assert.Throws <KeyNotFoundException>(() => DeserializeMethodCache <LazyPrimitive> .Deserialize); // still not registered, should be null builder.Register(storage); Assert.NotNull(DeserializeMethodCache <LazyPrimitive> .Deserialize); // should be set now }