public void CreateSection_Always_WillCreateASection() { var section = _sectionFactory.CreateSection(new StringReader(@"Sec1 1")); Assert.IsInstanceOf(typeof(ISection), section); Assert.That("Sec1", Is.EqualTo(section.Name)); }
public void CreateSection_WillCreateAsectionWithName() { var section = _sectionFactory.CreateSection(new StringReader("Section 0")); Assert.IsInstanceOf(typeof(ISection), section); Assert.AreEqual("Section", section.Name); }
public void CreateSectionTests() { var s = SectionFactory.CreateSection("foo", Grammar.DefaultDelimiters); Assert.AreEqual("[", s.Tokens[0]); Assert.AreEqual("foo", s.Tokens[1]); Assert.AreEqual("]", s.Tokens[2]); }
public void CreateSection_Always_WillReturnASectionWithName() { var sectionFactory = new SectionFactory(); ISection section = sectionFactory.CreateSection(new StringReader("Section 0")); Assert.AreEqual("Section", section.Name); }
public void CreateSection_Always_WillReturnASection() { SectionFactory sectionFactory = new SectionFactory(); var section = sectionFactory.CreateSection(new StringReader("Sec1 0")); Assert.IsInstanceOf(typeof(ISection), section); Assert.AreEqual("Sec1", section.Name); }
public void AddsProperty() { var sentence = SectionFactory.CreateSection("foo", Grammar.DefaultDelimiters); var section = new IniSection(sentence, null); Assert.AreEqual("foo", section.Name); Assert.IsFalse(section.Comments.Any()); Assert.IsFalse(section.Properties.Any()); }
public void CreateSectioUrn_WillCreateASectionWithName() { SectionFactory sectionFactory = new SectionFactory(); var section = sectionFactory.CreateSection(new StringReader("Sec1 0")); Assert.IsInstanceOf(typeof(ISection), section); Assert.AreEqual("Sec1", section.Name); }
public void CreateSection_Always_WilCreateASectionWithNameAndIndex() { SectionFactory sectionFactory = new SectionFactory(); var section = sectionFactory.CreateSection(new StringReader("Sec1 0"), 1); Assert.IsInstanceOf(typeof(ISection), section); Assert.AreEqual("Sec1", section.Name); Assert.AreEqual(1, section.Index); }
public void DisallowsDuplicateProperties() { var sentence = SectionFactory.CreateSection("foo", Grammar.DefaultDelimiters); var section = new IniSection(sentence, new IniFile(sentence, new IniSettings { DuplicatePropertyHandling = DuplicatePropertyHandling.Disallow })); section.AddProperty("bar", "baz"); section.AddProperty("bar", "qux"); }
public void CreateSection_WhenContainsQuestions_WillSetTheListOfQuestions() { var mockQuestionFactory = new Mock <IQuestionFactory>(); var sectionFactory = new SectionFactory { QuestionFactory = mockQuestionFactory.Object }; ISection section = sectionFactory.CreateSection(new StringReader(@"Section 1 Q1 Name")); Assert.AreEqual(1, section.Questions.Count); }
public void AddPropertyTests() { var sentence = SectionFactory.CreateSection("foo", Grammar.DefaultDelimiters); var section = new IniSection(sentence, new IniFile()); section.AddComment("baz"); section.AddComment("qux"); Assert.IsTrue(section.Comments.Count() == 2); Assert.IsTrue(section.Comments.ElementAt(0) == "baz"); Assert.IsTrue(section.Comments.ElementAt(1) == "qux"); }
public void CreateSection_WhenContainsQuestions_WillSetTheQuestionsList() { Mock <IQuestionFactory> mockQuestionFactory = new Mock <IQuestionFactory>(); SectionFactory sectionFactory = new SectionFactory { QuestionFactory = mockQuestionFactory.Object }; var section = sectionFactory.CreateSection(new StringReader(@"Sec1 1 Q1 Name"), 2); Assert.AreEqual(1, section.Questions.Count); }
public void CreateSection_WillCreateASectionWithQuestions() { Mock <IQuestionFactory> mockQuestionFactory = new Mock <IQuestionFactory>(); SectionFactory sectionFactory = new SectionFactory { QuestionFactory = mockQuestionFactory.Object }; var section = sectionFactory.CreateSection(new StringReader(@"Sec1 1 Q1 Name")); Assert.AreEqual(1, section.Questions.Count); }
public void CreateSection_WhenHasQuestions_WillSetTheLIstOfQuestions() { Mock <IQuestionFactory> mock = new Mock <IQuestionFactory>(); SectionFactory sectionFactory = new SectionFactory { QuestionFactory = mock.Object }; var section = sectionFactory.CreateSection(new StringReader(@"Section 2 Q1 NAme Q2 Age")); Assert.AreEqual(2, section.Questions.Count); }
public void CreateSection_Always_WillCreateASectionWithNameAndListOfQuestions() { Mock <IQuestionFactory> mockQuestion = new Mock <IQuestionFactory>(); SectionFactory sectionFactory = new SectionFactory { QuestionFactory = mockQuestion.Object }; var section = sectionFactory.CreateSection(new StringReader(@"Sec1 1 Q1 Name")); Assert.IsInstanceOf(typeof(ISection), section); Assert.AreEqual(1, section.Questions.Count); }
public void CreateSection_Always_WillReturnASectionWithQuestions() { Mock <IQuestionFacrory> mock = new Mock <IQuestionFacrory> { DefaultValue = DefaultValue.Mock }; SectionFactory sectionFactory = new SectionFactory { QuestionFactory = mock.Object }; var section = sectionFactory.CreateSection(new StringReader(@"Sec1 1 Q1 Name")); Assert.AreEqual(1, section.Questions.Count); }
public void AllowsDuplicateProperties() { var sentence = SectionFactory.CreateSection("foo", Grammar.DefaultDelimiters); var section = new IniSection(sentence, new IniFile(sentence, new IniSettings { DuplicatePropertyHandling = DuplicatePropertyHandling.Allow })); section.AddProperty("bar", "baz"); section.AddProperty("bar", "qux"); Assert.IsTrue(section.Properties.Count() == 2); Assert.IsTrue(section.Properties.Count(x => x.Name.Equals("bar", StringComparison.OrdinalIgnoreCase)) == 2); }
public void KeepsLastDuplicateProperty() { var sentence = SectionFactory.CreateSection("foo", Grammar.DefaultDelimiters); var section = new IniSection(sentence, new IniFile(sentence, new IniSettings { DuplicatePropertyHandling = DuplicatePropertyHandling.KeepLast })); section.AddProperty("bar", "baz"); section.AddProperty("bar", "qux"); Assert.IsTrue(section.Properties.Count() == 1); Assert.AreEqual("qux", section["bar"].Value); }
public void CreateSection_Always_WillCreateASectionWithAListOfQuestions() { Mock <IQuestionFactory> mock = new Mock <IQuestionFactory> { DefaultValue = DefaultValue.Mock }; SectionFactory sectionFactory = new SectionFactory { Question = mock.Object }; var section = sectionFactory.CreateSection(new StringReader(@"Sec1 2 Q1 FT Numele Q2 Ft Prenumele")); Assert.That("Sec1", Is.EqualTo(section.Name)); Assert.That(section.Questions.Count, Is.EqualTo(2)); }