public void TestMethod1() { var grandparent = new Grandparent(); var expectedType = typeof(Parent); var result = grandparent.GetParent(); var resultType = result.GetType(); Assert.True(resultType.Equals(expectedType)); }
public void test_nested_data_property_export_should_success() { var file_path = Path.Combine(Folder, $"nested_data_property_export_{DateTime.Now.ToString("yyyyMMdd_HHmmssfff")}.xlsx"); var builder = new SimpleSpreadsheetDocumentBuilder(file_path); List <Object> data = new List <object>(); var random = new Random(); for (var i = 0; i < 20; i++) { Grandparent grandparent = new Grandparent() { Name = "Grand Parent", Age = 101, BirthDay = new DateTime(1920, 1, 1), Amy = new Child() { Name = $"Amy {i}", Age = i, BirthDay = DateTime.Today.AddYears(-i * 5), Omy = new GrandChild() { Name = $"Omy {i}", Age = i, BirthDay = DateTime.Today.AddYears(-i * 2), } }, Jimmy = new Child() { Name = $"Jimmy {i}", Age = i, BirthDay = DateTime.Today.AddYears(-i * 3), Omy = null }, Tommy = null }; if (i % 2 == 0) { grandparent.Tommy = new GrandChild { Age = 11, BirthDay = DateTime.Today, Name = $"Tommy {i}" }; } data.Add(grandparent); } builder.AddDataToSheet("Family", data); builder.Close(); }