public void Can_Map_Nullable_Booleans() { var subject = new BooleansSubject(); CommandLineMapper.Map(subject, new[] { "--bar" }); Assert.That(subject.Foo, Is.False); Assert.That(subject.Bar.GetValueOrDefault(), Is.True); Assert.That(subject.Baz, Is.False); CommandLineMapper.Map(subject, new[] { "--bar:true" }); Assert.That(subject.Foo, Is.False); Assert.That(subject.Bar.GetValueOrDefault(), Is.True); Assert.That(subject.Baz, Is.False); CommandLineMapper.Map(subject, new[] { "--bar:false" }); Assert.That(subject.Foo, Is.False); Assert.That(subject.Bar.GetValueOrDefault(), Is.False); Assert.That(subject.Baz, Is.False); }
public void Can_Map_Booleans_Switch_Or_Value() { var subject = new BooleansSubject(); CommandLineMapper.Map(subject, new[] { "--foo"}); Assert.That(subject.Foo, Is.True); Assert.That(subject.Bar, Is.Null); Assert.That(subject.Baz, Is.False); CommandLineMapper.Map(subject, new[] { "--foo:true" }); Assert.That(subject.Foo, Is.True); Assert.That(subject.Bar, Is.Null); Assert.That(subject.Baz, Is.False); CommandLineMapper.Map(subject, new[] { "--foo:false" }); Assert.That(subject.Foo, Is.False); Assert.That(subject.Bar, Is.Null); Assert.That(subject.Baz, Is.False); }
public void Can_Map_Nullable_Booleans() { var subject = new BooleansSubject(); CliMapper.Map(subject, new string[0], new[] { "--bar" }); Assert.That(subject.Foo, Is.False); Assert.That(subject.Bar.GetValueOrDefault(), Is.True); Assert.That(subject.Baz, Is.False); CliMapper.Map(subject, new string[0], new[] { "--bar:true" }); Assert.That(subject.Foo, Is.False); Assert.That(subject.Bar.GetValueOrDefault(), Is.True); Assert.That(subject.Baz, Is.False); CliMapper.Map(subject, new string[0], new[] { "--bar:false" }); Assert.That(subject.Foo, Is.False); Assert.That(subject.Bar.GetValueOrDefault(), Is.False); Assert.That(subject.Baz, Is.False); }
public void Can_Map_Booleans_Switch_Or_Value() { var subject = new BooleansSubject(); CliMapper.Map(subject, new string[0], new[] { "--foo" }); Assert.That(subject.Foo, Is.True); Assert.That(subject.Bar, Is.Null); Assert.That(subject.Baz, Is.False); CliMapper.Map(subject, new string[0], new[] { "--foo:true" }); Assert.That(subject.Foo, Is.True); Assert.That(subject.Bar, Is.Null); Assert.That(subject.Baz, Is.False); CliMapper.Map(subject, new string[0], new[] { "--foo:false" }); Assert.That(subject.Foo, Is.False); Assert.That(subject.Bar, Is.Null); Assert.That(subject.Baz, Is.False); }