public void HowToUseTheDictionary() { var variables = new VariableDictionary(); variables.Set("Foo", "Bar"); variables.Set("IsFamous", "True"); variables.Set("FriendCount", "99"); variables.Set("InstallPath", "C:\\#{Directory}"); variables.Set("Directory", "MyDirectory"); variables.Get("InstallPath").Should().Be("C:\\MyDirectory"); variables.GetRaw("InstallPath").Should().Be("C:\\#{Directory}"); variables.GetFlag("IsFamous").Should().Be(true); variables.GetFlag("IsInfamous").Should().Be(false); variables.GetFlag("IsInfamous", true).Should().Be(true); variables.GetInt32("FriendCount").Should().Be(99); variables.GetInt32("FollowerCount").Should().Be(null); }
public void HowToUseTheDictionary() { var variables = new VariableDictionary(); variables.Set("Foo", "Bar"); variables.Set("IsFamous", "True"); variables.Set("FriendCount", "99"); variables.Set("InstallPath", "C:\\#{Directory}"); variables.Set("Directory", "MyDirectory"); Assert.That(variables.Get("InstallPath"), Is.EqualTo("C:\\MyDirectory")); Assert.That(variables.GetRaw("InstallPath"), Is.EqualTo("C:\\#{Directory}")); Assert.That(variables.GetFlag("IsFamous"), Is.EqualTo(true)); Assert.That(variables.GetFlag("IsInfamous"), Is.EqualTo(false)); Assert.That(variables.GetFlag("IsInfamous", true), Is.EqualTo(true)); Assert.That(variables.GetInt32("FriendCount"), Is.EqualTo(99)); Assert.That(variables.GetInt32("FollowerCount"), Is.EqualTo(null)); }
public void UseDictionaryWithCollectionInitializer() { var variables = new VariableDictionary { { "Foo", "Bar" }, { "IsFamous", "True" }, { "FriendCount", "99" }, { "InstallPath", "C:\\#{Directory}" }, { "Directory", "MyDirectory" } }; variables.Get("InstallPath").Should().Be("C:\\MyDirectory"); variables.GetRaw("InstallPath").Should().Be("C:\\#{Directory}"); variables.GetFlag("IsFamous").Should().Be(true); variables.GetFlag("IsInfamous").Should().Be(false); variables.GetFlag("IsInfamous", true).Should().Be(true); variables.GetInt32("FriendCount").Should().Be(99); variables.GetInt32("FollowerCount").Should().Be(null); }