public void CanDeserializeNullableEnum(string barValue, Garply? expectedBarValue)
        {
            var serializer = new JsonSerializer<Foo4>();

            var json = @"{""Bar"":" + barValue + "}";

            var foo = serializer.Deserialize(json);

            Assert.That(foo.Bar, Is.EqualTo(expectedBarValue));
        }
        public void CanSerializeNullableEnum(Garply? barValue, string expectedBarValue)
        {
            var serializer = new JsonSerializer<Foo4>();

            var foo = new Foo4 { Bar = barValue };

            var json = serializer.Serialize(foo);

            Assert.That(json, Is.EqualTo(@"{""Bar"":" + expectedBarValue + "}"));
        }
        public void MissingConstructorParametersAreSuppliedByTheResolver()
        {
            var config = new ConfigurationBuilder()
                         .AddInMemoryCollection(new Dictionary <string, string> {
                { "waldo", "123" }
            })
                         .Build();

            var garply = new Garply();

            var defaultTypes = new DefaultTypes().Add(typeof(IGrault), typeof(Grault));
            var resolver     = new Resolver(t => garply, t => t == typeof(IGarply));

            var grault = config.CreateReloadingProxy <IGrault>(defaultTypes, resolver: resolver);

            Assert.Same(garply, grault.Garply);
            Assert.Equal(123, grault.Waldo);

            ChangeConfig(config, new KeyValuePair <string, string>("waldo", "456"));

            Assert.Same(garply, grault.Garply);
            Assert.Equal(456, grault.Waldo);
        }
예제 #4
0
 public void OnGarply() => Garply?.Invoke(this, EventArgs.Empty);
예제 #5
0
 public void CanInstantiateGarply()
 {
     var garply = new Garply();
 }