コード例 #1
0
        public void EmptyRequestShouldBeRejectedAndPrintUsageInfo()
        {
            var    testSubject = new MigrateTo();
            Action call        = () => testSubject.Validate();

            call.Should().Throw <TerminateAndShowHelp>();
        }
コード例 #2
0
        public void ValidRequestShouldBeAccepted()
        {
            var testSubject = new MigrateTo {
                Engine = "sqlite", ConnectionString = "valid", MigrationFolderName = "valid"
            };
            Action call = () => testSubject.Validate();

            call.Should().NotThrow();
        }
コード例 #3
0
        public void InvalidEngineShouldBeRejectedWithUsefulErrorMessage()
        {
            var testSubject = new MigrateTo
            {
                Engine              = "not a valid engine",
                ConnectionString    = "valid",
                MigrationFolderName = "valid"
            };
            Action call = () => testSubject.Validate();

            call.Should().Throw <TerminateProgramWithMessageException>()
            .WithMessage(
                $"I don't know the database engine '{testSubject.Engine}'. I only understand how to communicate with {DbEngine.KnownEngineNames}. Please extend me if you want to use that engine.");
        }