public void WhenBadDateFormatShouldFail() { var yaml = @" ignore: commits-before: bad format date "; using var reader = new StringReader(yaml); Should.Throw <YamlException>(() => ConfigSerializer.Read(reader)); }
public void WhenNotInConfigShouldHaveDefaults() { var yaml = @" next-version: 1.0 "; using var reader = new StringReader(yaml); var config = ConfigSerializer.Read(reader); config.Ignore.ShouldNotBeNull(); config.Ignore.ShAs.ShouldBeEmpty(); config.Ignore.Before.ShouldBeNull(); }
public void ShouldSupportsOtherSequenceFormat() { var yaml = @" ignore: sha: - b6c0c9fda88830ebcd563e500a5a7da5a1658e98 - 6c19c7c219ecf8dbc468042baefa73a1b213e8b1 "; using var reader = new StringReader(yaml); var config = ConfigSerializer.Read(reader); config.Ignore.ShouldNotBeNull(); config.Ignore.ShAs.ShouldNotBeEmpty(); config.Ignore.ShAs.ShouldBe(new[] { "b6c0c9fda88830ebcd563e500a5a7da5a1658e98", "6c19c7c219ecf8dbc468042baefa73a1b213e8b1" }); }
public void CanDeserialize() { var yaml = @" ignore: sha: [b6c0c9fda88830ebcd563e500a5a7da5a1658e98] commits-before: 2015-10-23T12:23:15 "; using var reader = new StringReader(yaml); var config = ConfigSerializer.Read(reader); config.Ignore.ShouldNotBeNull(); config.Ignore.ShAs.ShouldNotBeEmpty(); config.Ignore.ShAs.ShouldBe(new[] { "b6c0c9fda88830ebcd563e500a5a7da5a1658e98" }); config.Ignore.Before.ShouldBe(DateTimeOffset.Parse("2015-10-23T12:23:15")); }
public Config ReadConfig(string workingDirectory) { var configFilePath = GetConfigFilePath(workingDirectory); if (this.fileSystem.Exists(configFilePath)) { var readAllText = this.fileSystem.ReadAllText(configFilePath); var readConfig = ConfigSerializer.Read(new StringReader(readAllText)); VerifyReadConfig(readConfig); return(readConfig); } return(new Config()); }
public void Should_Read_Label_Aliases() { // Given var text = Resources.Default_Configuration_Yaml; // When var config = ConfigSerializer.Read(new StringReader(text)); // Then Assert.AreEqual(2, config.LabelAliases.Count); Assert.AreEqual("Bug", config.LabelAliases[0].Name); Assert.AreEqual("Foo", config.LabelAliases[0].Header); Assert.AreEqual("Bar", config.LabelAliases[0].Plural); Assert.AreEqual("Improvement", config.LabelAliases[1].Name); Assert.AreEqual("Baz", config.LabelAliases[1].Header); Assert.AreEqual("Qux", config.LabelAliases[1].Plural); }
void Awake() { SetupSerializers(); defaultKeys.Dictionary = defaultBindsSerializer.Read(); keys.Dictionary = keyBindsSerializer.Read(); }