public void When_twice_the_same_column_name_with_different_case_then_WithColumn_should_throw_ApplicationException() { // Arrange Table table = new Table("table1"); // Act & Assert Assert.Throws<ApplicationException>(() => table.WithColumn("c1") .WithColumn("C1")); }
public void Then_WithColumn_should_create_a_new_column() { // Arrange Table table = new Table("table1"); // Act Column column = table.WithColumn("Column1"); // Assert Assert.That(column.Name, Is.EqualTo("Column1")); }
public void Then_WithColumn_should_be_used_to_add_columns_to_a_table() { // Arrange Table table = new Table("table1"); // Act table.WithColumn("c1") .WithColumn("c2") .WithColumn("c3"); // Assert Assert.That(table.Columns.Count, Is.EqualTo(3)); }
public void Given_a_table_with_a_missing_column_then_the_missing_column_should_be_detected() { // Arrange Table t1 = new Table("t1"); t1.WithColumn("c1"); Table t2 = new Table("t1"); // Act CompareResult result = t1.Compare(t2); // Assert Assert.That(result.MissingList.Count, Is.EqualTo(1)); Assert.That(result.MissingList[0].Name, Is.EqualTo("c1")); }
public void Given_two_tables_with_different_columnType_then_conflict_should_be_detected() { // Arrange Table t1 = new Table("t1"); Column expectedFirst = t1.WithColumn("c1").OfType("int", 4); t1.WithColumn("irrelevant").OfType("varchar", 3); Table t2 = new Table("t1"); Column expectedSecond = t2.WithColumn("c1").OfType("varchar", 4); t2.WithColumn("irrelevant").OfType("varchar", 3); // Act CompareResult result = t1.Compare(t2); // Assert Assert.That(result.ConflictList.Count, Is.EqualTo(1)); Assert.That(result.ConflictList[0].First, Is.SameAs(expectedFirst)); Assert.That(result.ConflictList[0].Second, Is.SameAs(expectedSecond)); }
public void Given_a_table_with_extra_columns_then_the_extra_columns_should_be_ignored() { // Arrange Table t1 = new Table("t1"); t1.WithColumn("c1"); Table t2 = new Table("t1"); t2.WithColumn("c1"); t2.WithColumn("c2"); // Act CompareResult result = t1.Compare(t2); // Assert Assert.That(result.HaveValues, Is.False); }