public void VerifyLithologyContainsMeasurement() { LithologicDescription description = new LithologicDescription(); Measurement measurement = new Measurement(); description.StartOffset.Offset = 0; description.EndOffset.Offset = 10; SectionInfo section = new SectionInfo(); section.Expedition = "356"; section.Site = "U1500"; section.Hole = "A"; section.Core = "10"; section.Type = "H"; section.Section = "3"; measurement.StartOffset.SectionInfo = section; measurement.EndOffset.SectionInfo = section; description.SectionInfo = section; measurement.StartOffset.Offset = 5; measurement.EndOffset.Offset = 5; Assert.IsTrue(description.Contains(measurement.StartOffset)); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); // Build configuration configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetParent(AppContext.BaseDirectory).FullName) .AddJsonFile("appsettings.json", false) .Build(); //IServiceCollection services = new ServiceCollection(); //services.AddDbContext<DescDBContext>(options => options.UseSqlServer(configuration.GetConnectionString("DESCDatabase"))); Console.WriteLine(configuration.GetConnectionString("DESCDatabase")); using (var db = new DescDBContext()) { for (int i = 30; i < 40; i++) { var ld = new LithologicDescription() { LithologicID = i.ToString(), DescriptionGroup = "Paleo", DescriptionType = "Macro", DescriptionTab = "Nanno", DescriptionReport = "Paleo" }; db.LithologicDescriptions.AddAsync(ld); db.SaveChangesAsync(); } } }
public void Test_LithologicIDGenerator() { //Trial 1: LithologicDescription ld = new LithologicDescription(); ld.StartOffset = new OffsetInfo(); ld.EndOffset = new OffsetInfo(); ld.SectionInfo.Expedition = "379T"; ld.SectionInfo.Site = "U1456A"; ld.SectionInfo.Hole = "A"; ld.SectionInfo.Core = "43"; ld.SectionInfo.Type = "R"; ld.SectionInfo.Section = "CC"; ld.StartOffset.Offset = 20.01; ld.EndOffset.Offset = 5.25; LithologicIDGenerator generator = new LithologicIDGenerator(); generator.GenerateID(ld); //I'm writing the output string with spaces to understand the format of the underlying numbers string result = ("379 20 1456 01 043 18 99 01 0020010 0005250").Replace(" ", string.Empty); //379 20 1456 01 043 18 99 01 0000100 0005250 //379 20 1456 01 043 18 99 01 0010010 0005250 // Assert.IsTrue(generator.GenerateOffset("5.25") == "0005" + "250"); Assert.IsTrue(generator.GenerateID(ld) == result); //Trial 2: ld.SectionInfo.Expedition = "379"; ld.SectionInfo.Site = "U1456C"; ld.SectionInfo.Hole = "C"; ld.SectionInfo.Core = "8"; ld.SectionInfo.Type = "H"; ld.SectionInfo.Section = "5"; ld.StartOffset.Offset = 0; ld.EndOffset.Offset = 0; generator.GenerateID(ld); //I'm writing the output string with spaces to understand the format of the underlying numbers result = ("379 00 1456 03 008 08 05 01 0000000 0000000").Replace(" ", string.Empty); // Assert.IsTrue(generator.GenerateOffset("5.25") == "0005" + "250"); Assert.IsTrue(generator.GenerateID(ld) == result); }