public void Does_RelayCalls() { var spySection = new SpyConfigIniSection(); var writer = new StringWriter(); spySection.Write(writer); Assert.That(spySection.WriteTokens_CallCount, Is.EqualTo(1)); }
public void When_HasSections_RelaysCallsToSections() { var callLog = new List <ConfigIniSection>(); var config = new ConfigIni(); var spySectionA = new SpyConfigIniSection("A") { Write_CallLog = callLog }; var spySectionB = new SpyConfigIniSection("B") { Write_CallLog = callLog }; config.Sections.Add(spySectionA); config.Sections.Add(spySectionB); var writer = new StringWriter(); config.Write(writer); Assert.That(callLog, Is.EquivalentTo(new[] { spySectionA, spySectionB })); }
public void When_HasNullSections_DoesSkipNull() { var callLog = new List <ConfigIniSection>(); var config = new ConfigIni(); var spySectionA = new SpyConfigIniSection("A") { Write_CallLog = callLog }; var spySectionB = new SpyConfigIniSection("B") { Write_CallLog = callLog }; config.Sections.Add(spySectionA); config.Sections.Add(null); config.Sections.Add(spySectionB); var writer = new StringWriter(); config.Write(writer); Assert.That(config.Sections, Has.Count.EqualTo(3)); Assert.That(callLog, Is.EquivalentTo(new[] { spySectionA, spySectionB })); }