Example #1
0
        private async Task ExtractDatabaseEntities(string solutionUnderTest, Solution solution)
        {
            await _databaseEntityDeclarationExtractor.FindDatabaseEntityDeclarationsAsync(solution, _progressIndicator);

            _progressIndicator.Report(new ExtractionProgress("Saving Database Entity Declarations into json file."));
            await _serializer.Serialize(_databaseEntityDeclarationExtractor.DatabaseEntityDeclarations, solutionUnderTest);

            _progressIndicator.Report(new ExtractionProgress("Done"));
        }
        public async Task DetectsDatabaseEntityDeclarations_When_RoslynComplexSolutionIsUsed()
        {
            //Arrange
            var solGen   = new RoslynComplexSolutionGenerator();
            var solution = solGen.GetRoslynSolution();

            //ToDo: change to use TargetBuilder
            Context <LINQToSQL> context = new ContextStub <LINQToSQL>();

            target = new DatabaseEntityDeclarationExtractor(context);

            var progressIndicator = new ProgressStub();
            //Act
            await target.FindDatabaseEntityDeclarationsAsync(solution, progressIndicator);

            var result = target.DatabaseEntityDeclarations;

            //Assert
            Assert.IsTrue(result.Count() == 3);
            Assert.IsTrue(result.ToList().Exists(x => x.Name == "Customer"));
            Assert.IsTrue(result.ToList().Exists(x => x.Name == "Order"));
            Assert.IsTrue(result.ToList().Exists(x => x.Name == "OrderItem"));
        }