Example #1
0
        private SourceFile SourceFile(string path)
        {
            var source = new SourceFile()
            {
                Path = Path.Absolute(path),
            };

            source.InitDependencyMaps(0, 1);

            return(source);
        }
Example #2
0
        public static ISourceFile CreateSourceFileWithRandomContent(int fingerprintSize)
        {
            // It is ok to create an empty source file for the testing purposes.
            var result = new SourceFile();

            result.Path = Path.Absolute(A("c") + RandomString(24) + ".dsc");
            result.SetBindingFingerprintByTest(CraeteFingerprintWithRandomContent(fingerprintSize));
            result.SetFileDependentsByTest(CraeteBitArrayWithRandomContent(fingerprintSize));
            result.SetFileDependenciesByTest(CraeteBitArrayWithRandomContent(fingerprintSize));

            return(result);
        }
Example #3
0
        public void _001_basic_usage()
        {
            var path = _temp.GetPath("001.mkd");

            var sut = new DemoDbClient(Settings.DllPath);

            using (var employeeManager = sut.Employee(Path.Absolute(path))) {
                employeeManager.Operator.Create(overwrite: true);

                using (var transaction = sut.BeginTransaction()) {
                    foreach (var employee in EntityFactory.EnumerateEmployees())
                    {
                        employeeManager.Add(employee);
                    }
                    transaction.Commit();
                }

                Assert.Equal(EntityFactory.EnumerateEmployees(), employeeManager.Query());
                Assert.Equal(EntityFactory.EnumerateEmployees().Where(e => e.LastName.LessThan("B")), employeeManager.QueryByKey(null, e => e.LastName.LessThan("B")));
                Assert.Equal(
                    EntityFactory.EnumerateEmployees()
                    .OrderBy(e => e.Id),
                    employeeManager.QueryByKey(keys => keys.Key0));
                Assert.Equal(
                    EntityFactory.EnumerateEmployees()
                    .OrderBy(e => e.FirstName)
                    .ThenBy(e => e.LastName),
                    employeeManager.QueryByKey(keys => keys.Key1));
                Assert.Equal(
                    EntityFactory.EnumerateEmployees()
                    .Single(e => e.Id == 5),
                    employeeManager.Get(e => e.Id == 5));
                Assert.Equal(
                    EntityFactory.EnumerateEmployees()
                    .Where(e => e.FirstName.LessThan("T"))
                    .OrderBy(e => e.FirstName)
                    .ThenBy(e => e.LastName),
                    employeeManager.Query(e => e.FirstName.LessThan("T")));
            }
        }