public void Can_set_the_value_on_the_property_regardless_of_question_mark() { var person = new Person { ClientProfile = true }; person.SetPropertyValue("Client Profile?", true); person.ClientProfile.ShouldEqual(true); }
public void Can_set_the_value_on_the_property_regardless_of_casing() { var person = new Person { FullName = "Howard Roark" }; person.SetPropertyValue("full name", "John Galt"); person.FullName.ShouldEqual("John Galt"); }
public void Can_set_the_value_on_the_property_regardless_of_hyphen() { var person = new Person { NoBreakSupplier = "Howard Roark" }; person.SetPropertyValue("No-Break Supplier", "John Galt"); person.NoBreakSupplier.ShouldEqual("John Galt"); }
public void Can_get_the_property_of_an_object_even_if_the_casing_is_wrong() { var person = new Person { FullName = "Howard Roark" }; person.GetPropertyValue("fullname") .ShouldEqual("Howard Roark"); }
public void Can_set_the_value_on_the_property_regardless_of_spaces() { var person = new Person { FullName = "Howard Roark" }; person.SetPropertyValue("Full Name", "John Galt"); person.FullName.Should().Be("John Galt"); }
public void Can_get_the_property_of_an_object_even_if_the_name_has_extra_spaces() { var person = new Person {FullName = "Howard Roark"}; person.GetPropertyValue("Full Name") .ShouldEqual("Howard Roark"); }
public void Can_set_the_value_on_the_property_through_SetPropertyValue() { const string expectedValue = "John Galt"; var person = new Person { FullName = "Howard Roark" }; person.SetPropertyValue("FullName", expectedValue); Assert.AreEqual(expectedValue, person.FullName); }
public void Can_get_the_property_of_an_object_through_GetPropertyValue() { const string expectedValue = "John Galt"; var person = new Person { FullName = expectedValue }; var value = person.GetPropertyValue("FullName"); Assert.AreEqual(expectedValue, value); }
public void It_should_return_multiple_matches_if_they_can_be_Found() { var john = new Person {FirstName = "John", LastName = "Doe"}; var jane = new Person {FirstName = "Jane", LastName = "Doe"}; var records = new List<Person> { john, jane}; var table = new Table("Field", "Value"); table.AddRow("LastName", "Doe"); var results = table.FindAllInSet(records); results.Count().Should().Be(2); results.Should().Contain(john); results.Should().Contain(jane); }
public void It_should_throw_if_multiple_results_can_be_found() { var john = new Person {FirstName = "John", LastName = "Doe"}; var jane = new Person {FirstName = "Jane", LastName = "Doe"}; var records = new List<Person> { john, jane}; var table = new Table("Field", "Value"); table.AddRow("LastName", "Doe"); Exception exception = null; try { table.FindInSet(records); } catch (ComparisonException ex) { exception = ex; } exception.Should().NotBeNull(); exception.Message.Should().Be("Multiple instances match the table"); }
public void Usage_example() { var howardRoark = new Person {FirstName = "Howard", LastName = "Roark"}; var johnGalt = new Person {FirstName = "John", LastName = "Galt"}; var records = new List<Person> {howardRoark, johnGalt}; Table table; table = new Table("Field", "Value"); table.AddRow("FirstName", "Howard"); table.FindInSet(records).Should().Be(howardRoark); table = new Table("Field", "Value"); table.AddRow("LastName", "Galt"); table.FindInSet(records).Should().Be(johnGalt); table = new Table("Field", "Value"); table.AddRow("LastName", "Keating"); table.FindInSet(records).Should().BeNull(); }
public void Usage_example() { var john = new Person {FirstName = "John", LastName = "Doe"}; var jane = new Person {FirstName = "Jane", LastName = "Doe"}; var records = new List<Person> {john, jane}; Table table; table = new Table("Field", "Value"); table.AddRow("FirstName", "John"); table.FindAllInSet(records).Count().Should().Be(1); table.FindAllInSet(records).Should().Contain(john); table = new Table("Field", "Value"); table.AddRow("LastName", "Doe"); table.FindAllInSet(records).Count().Should().Be(2); table.FindAllInSet(records).Should().Contain(john); table.FindAllInSet(records).Should().Contain(jane); table = new Table("Field", "Value"); table.AddRow("LastName", "Trump"); table.FindAllInSet(records).Count().Should().Be(0); }