public void BuildMergeDataOutputTests() { var definition = new DataMergeDefinition(); DataMergeDefinition.AutoMap <UserImport>(definition); definition.Columns.Should().NotBeNullOrEmpty(); definition.IncludeOutput = true; definition.TargetTable = "dbo.User"; var column = definition.Columns.Find(c => c.SourceColumn == "EmailAddress"); column.Should().NotBeNull(); column.IsKey = true; column.CanUpdate = false; var users = new List <UserImport> { new UserImport { EmailAddress = "*****@*****.**", DisplayName = "Test User", FirstName = "Test", LastName = "User" }, new UserImport { EmailAddress = "*****@*****.**", DisplayName = "Blah User", FirstName = "Blah", LastName = "User" }, new UserImport { EmailAddress = $"random.{DateTime.Now.Ticks}@email.com", DisplayName = "Random User", FirstName = "Random", LastName = "User" } }; var dataTable = users.ToDataTable(); var sql = DataMergeGenerator.BuildMerge(definition, dataTable); sql.Should().NotBeNullOrEmpty(); Output.WriteLine("MergeStatement:"); Output.WriteLine(sql); }
public void BuildMergeTests() { var definition = new DataMergeDefinition(); DataMergeDefinition.AutoMap <UserImport>(definition); definition.Columns.Should().NotBeNullOrEmpty(); definition.TargetTable = "dbo.User"; var column = definition.Columns.Find(c => c.SourceColumn == "EmailAddress"); column.Should().NotBeNull(); column.IsKey = true; column.CanUpdate = false; var sql = DataMergeGenerator.BuildMerge(definition); sql.Should().NotBeNullOrEmpty(); Output.WriteLine("MergeStatement:"); Output.WriteLine(sql); }