Esempio n. 1
0
        public async void PostErrorCanCreateNewErrors(string errorName)
        {
            DbContextOptions <BrokenAPIContext> options =
                new DbContextOptionsBuilder <BrokenAPIContext>()
                .UseInMemoryDatabase(errorName)
                .Options;

            using (BrokenAPIContext context = new BrokenAPIContext(options))
            {
                // Arrange
                ErrorController ec = new ErrorController(context);

                Error newError = new Error
                {
                    ErrorCategoryID = 0,
                    DetailedName    = errorName,
                    Description     = "This is a test.",
                    Link            = "test",
                    CodeExample     = "test",
                    IsUserExample   = false,
                    Votes           = 0,
                    Rating          = 0
                };

                // Act
                await ec.PostError(newError);

                var results = context.Errors.Where(e => e.DetailedName == errorName);

                // Assert
                Assert.Equal(1, results.Count());
            }
        }
Esempio n. 2
0
        public async void GetAllCategoriesAsyncAsList()
        {
            DbContextOptions <BrokenAPIContext> options =
                new DbContextOptionsBuilder <BrokenAPIContext>()
                .UseInMemoryDatabase("TestDB")
                .Options;

            using (BrokenAPIContext context = new BrokenAPIContext(options))
            {
                var TestController = new ErrorCategoryController(context);

                await context.Categories.AddRangeAsync(
                    new ErrorCategory { ID = 1, Description = "test1", ErrorType = "firstTestObj" },
                    new ErrorCategory { ID = 2, Description = "test2", ErrorType = "Syntax" },
                    new ErrorCategory { ID = 3, Description = "test3", ErrorType = "Runtime" },
                    new ErrorCategory { ID = 4, Description = "test4", ErrorType = "fourthTestObj" });

                await context.SaveChangesAsync();

                var allCategory = TestController.GetAllCategories();

                await Assert.IsType <Task <List <ErrorCategory> > >(allCategory);

                Assert.Equal(4, allCategory.Result.Count());
            }
        }
Esempio n. 3
0
        public async void GetErrorCanReturnTheErrorFromSearch(string errName)
        {
            DbContextOptions <BrokenAPIContext> options =
                new DbContextOptionsBuilder <BrokenAPIContext>()
                .UseInMemoryDatabase(errName)
                .Options;

            using (BrokenAPIContext context = new BrokenAPIContext(options))
            {
                // Arrange
                ErrorController ec = new ErrorController(context);

                Error testError = new Error
                {
                    ErrorCategoryID = 0,
                    DetailedName    = errName,
                    Description     = "This is a test.",
                    Link            = "test",
                    CodeExample     = "test",
                    IsUserExample   = false,
                    Votes           = 0,
                    Rating          = 0
                };

                await context.Errors.AddAsync(testError);

                await context.SaveChangesAsync();

                // Act
                var foundError = ec.GetError(errName);

                // Assert
                Assert.Equal(errName, foundError.Result.Value.DetailedName);
            }
        }
Esempio n. 4
0
        public async void GetErrorCanReturnNotFoundIfErrorWithSearchNameDoesNotExistInDatabase()
        {
            DbContextOptions <BrokenAPIContext> options =
                new DbContextOptionsBuilder <BrokenAPIContext>()
                .UseInMemoryDatabase("GetErrorDb")
                .Options;

            using (BrokenAPIContext context = new BrokenAPIContext(options))
            {
                // Arrange
                ErrorController ec = new ErrorController(context);

                Error testError = new Error
                {
                    ErrorCategoryID = 0,
                    DetailedName    = "testError",
                    Description     = "This is a test.",
                    Link            = "test",
                    CodeExample     = "test",
                    IsUserExample   = false,
                    Votes           = 0,
                    Rating          = 0
                };

                await context.Errors.AddAsync(testError);

                await context.SaveChangesAsync();

                // Act
                var response = ec.GetError("differentError");

                // Assert
                Assert.Equal("Microsoft.AspNetCore.Mvc.NotFoundResult", response.Result.Result.ToString());
            }
        }
Esempio n. 5
0
        public async void DatabaseCanSaveErrors()
        {
            DbContextOptions <BrokenAPIContext> options =
                new DbContextOptionsBuilder <BrokenAPIContext>()
                .UseInMemoryDatabase("DbCanSave")
                .Options;

            using (BrokenAPIContext context = new BrokenAPIContext(options))
            {
                // Arrange
                Error newError = new Error
                {
                    ErrorCategoryID = 0,
                    DetailedName    = "testError",
                    Description     = "This is a test.",
                    Link            = "test",
                    CodeExample     = "test",
                    IsUserExample   = false,
                    Votes           = 0,
                    Rating          = 0
                };

                // Act
                await context.Errors.AddAsync(newError);

                await context.SaveChangesAsync();

                var results = context.Errors.Where(e => e.DetailedName == "testError");

                // Assert
                Assert.Equal(1, results.Count());
            }
        }
Esempio n. 6
0
        public async void DeleteErrorCanReturnNotFoundIfErrorNotFoundForGivenIDInDatabase()
        {
            DbContextOptions <BrokenAPIContext> options =
                new DbContextOptionsBuilder <BrokenAPIContext>()
                .UseInMemoryDatabase("deleteErrorIncorrectID")
                .Options;

            using (BrokenAPIContext context = new BrokenAPIContext(options))
            {
                // Arrange
                ErrorController ec = new ErrorController(context);

                Error newError = new Error
                {
                    ErrorCategoryID = 0,
                    DetailedName    = "Test",
                    Description     = "This is a testError.",
                    Link            = "test",
                    CodeExample     = "test",
                    IsUserExample   = false,
                    Votes           = 0,
                    Rating          = 0
                };

                await ec.PostError(newError);

                // Act
                var response = await ec.DeleteError(100);

                // Assert
                Assert.Equal("Microsoft.AspNetCore.Mvc.NotFoundResult", response.ToString());
            }
        }
Esempio n. 7
0
        public static async void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new BrokenAPIContext(
                       serviceProvider.GetRequiredService <DbContextOptions <BrokenAPIContext> >()))
            {
                if (context.Categories.Any())
                {
                    return;
                }

                await context.Categories.AddRangeAsync(
                    new ErrorCategory
                {
                    ErrorType   = "Logic",
                    Description = "Logic errors are those that appear once the application is in use. They are most often unwanted or unexpected results in response to user actions. For example, a mistyped key or other outside influence might cause your application to stop working within expected parameters, or altogether. Logic errors are generally the hardest type to fix, since it is not always clear where they originate.",
                },
                    new ErrorCategory
                {
                    ErrorType   = "Runtime",
                    Description = "Run-time errors are those that appear only after you compile and run your code. These involve code that may appear to be correct in that it has no syntax errors, but that will not execute. For example, you might correctly write a line of code to open a file. But if the file is corrupted, the application cannot carry out the Open function, and it stops running. You can fix most run-time errors by rewriting the faulty code, and then recompiling and rerunning it",
                },
                    new ErrorCategory
                {
                    ErrorType   = "Syntax",
                    Description = "Syntax errors are those that appear while you write code. Visual Basic checks your code as you type it in the Code Editor window and alerts you if you make a mistake, such as misspelling a word or using a language element improperly. Syntax errors are the most common type of errors. You can fix them easily in the coding environment as soon as they occur.",
                });

                await context.SaveChangesAsync();
            }
        }
Esempio n. 8
0
        public async void getAllCategoryAndErrorTest()
        {
            DbContextOptions <BrokenAPIContext> options =
                new DbContextOptionsBuilder <BrokenAPIContext>()
                .UseInMemoryDatabase("TestDB")
                .Options;

            using (BrokenAPIContext context = new BrokenAPIContext(options))
            {
                var TestController      = new ErrorCategoryController(context);
                var TestErrorController = new ErrorController(context);

                ArrayList testList = new ArrayList();

                await context.Errors.AddRangeAsync(
                    new Error
                {
                    ErrorCategoryID = 2,
                    DetailedName    = "Invalid Assignment",
                    CodeExample     =
                        "public static void Main(String[] args)\n" +
                        "{\n" +
                        "\tif (x = y)\n" +
                        "\t{\n" +
                        "\t\tConsole.WriteLine(x)\n" +
                        "\t}\n" +
                        "}",
                    IsUserExample = false,
                    Votes         = 0,
                    Rating        = 0,
                    Description   = "Error occurs when erroneously attempting to assign " +
                                    "values when doing a comparison, such as in an \"if statement\"."
                }, new Error
                {
                    ErrorCategoryID = 1,
                    DetailedName    = "Test 2",
                    CodeExample     =
                        "\t}\n" +
                        "}",
                    IsUserExample = false,
                    Votes         = 0,
                    Rating        = 0,
                    Description   = "Errortest"
                });

                var OneCategoryAndErrorResult = await TestController.GetAllTypesAndError();

                var OneErrorTestType2 = await context.Errors.Where(a => a.ID == 2).ToListAsync();

                testList.Add(OneCategoryAndErrorResult[0]);
                testList.Add(OneErrorTestType2);

                Assert.Equal(8, OneCategoryAndErrorResult.Capacity);//8 because first test adds 4 categories, 3rd test adds 2 errors and this one adds 2 more for total of 8.
            }
        }
Esempio n. 9
0
        public async void DeleteErrorCanRemoveAnErrorFromTheDatabaseAndReturnOk(string errorName)
        {
            DbContextOptions <BrokenAPIContext> options =
                new DbContextOptionsBuilder <BrokenAPIContext>()
                .UseInMemoryDatabase(errorName)
                .Options;

            using (BrokenAPIContext context = new BrokenAPIContext(options))
            {
                // Arrange
                ErrorController ec = new ErrorController(context);

                Error newError = new Error
                {
                    ErrorCategoryID = 0,
                    DetailedName    = errorName,
                    Description     = "This is a test.",
                    Link            = "test",
                    CodeExample     = "test",
                    IsUserExample   = false,
                    Votes           = 0,
                    Rating          = 0
                };

                await ec.PostError(newError);

                int errorID = 0;
                switch (errorName)
                {
                case "firstDeleteErrorTest":
                    errorID = 1;
                    break;

                case "secondDeleteErrorTest":
                    errorID = 2;
                    break;

                case "thirdDeleteErrorTest":
                    errorID = 3;
                    break;
                }

                // Act
                var response = await ec.DeleteError(errorID);

                var results = context.Errors.Where(e => e.DetailedName == errorName);

                // Assert
                Assert.Equal("Microsoft.AspNetCore.Mvc.OkResult", response.ToString());
                Assert.Equal(0, results.Count());
            }
        }
Esempio n. 10
0
        public async void GetOneCategoryAndErrorTest()
        {
            DbContextOptions <BrokenAPIContext> options =
                new DbContextOptionsBuilder <BrokenAPIContext>()
                .UseInMemoryDatabase("TestDB")
                .Options;

            using (BrokenAPIContext context = new BrokenAPIContext(options))
            {
                var TestController      = new ErrorCategoryController(context);
                var TestErrorController = new ErrorController(context);

                ArrayList testList = new ArrayList();

                await context.Errors.AddRangeAsync(
                    new Error
                {
                    ErrorCategoryID = 2,
                    DetailedName    = "Invalid Assignment",
                    CodeExample     =
                        "public static void Main(String[] args)\n",
                    IsUserExample = false,
                    Votes         = 0,
                    Rating        = 0,
                    Description   = "Error1"
                }, new Error
                {
                    ErrorCategoryID = 2,
                    DetailedName    = "Test 2",
                    CodeExample     =
                        "\t}\n" +
                        "}",
                    IsUserExample = false,
                    Votes         = 0,
                    Rating        = 0,
                    Description   = "Errortest"
                });

                var OneCategoryAndErrorResult = await TestController.GetAllTypeError("syntax"); //test method

                var OneErrorTest = await context.Errors.Where(a => a.ID == 2).ToListAsync();    //set error to test on

                var OneTestCategory = context.Categories.Where(c => c.ErrorType == "syntax");   //set category

                testList.Add(OneCategoryAndErrorResult);
                testList.Add(OneErrorTest);

                Assert.Equal(OneErrorTest, OneCategoryAndErrorResult[1]); //check to make sure result is expected outcome
                Assert.IsType <ArrayList>(OneCategoryAndErrorResult);     //check to make sure array is returned
            }
        }
Esempio n. 11
0
        public async void GetOneCategoryTest()
        {
            DbContextOptions <BrokenAPIContext> options =
                new DbContextOptionsBuilder <BrokenAPIContext>()
                .UseInMemoryDatabase("TestDB")
                .Options;

            using (BrokenAPIContext context = new BrokenAPIContext(options))
            {
                var TestController = new ErrorCategoryController(context);

                var OneCategoryResult = TestController.GetOneCategory("Syntax");

                Assert.Equal(1, OneCategoryResult.Id);
            }
        }
Esempio n. 12
0
        public async void PostErrorCanReturnConflictIfDetailedNameProvidedForErrorAlreadyExistsInDatabase()
        {
            DbContextOptions <BrokenAPIContext> options =
                new DbContextOptionsBuilder <BrokenAPIContext>()
                .UseInMemoryDatabase("postErrorSameName")
                .Options;

            using (BrokenAPIContext context = new BrokenAPIContext(options))
            {
                // Arrange
                ErrorController ec = new ErrorController(context);

                Error controlError = new Error
                {
                    ErrorCategoryID = 0,
                    DetailedName    = "controlError",
                    Description     = "This is a test.",
                    Link            = "test",
                    CodeExample     = "test",
                    IsUserExample   = false,
                    Votes           = 0,
                    Rating          = 0
                };

                Error testError = new Error
                {
                    ErrorCategoryID = 0,
                    DetailedName    = "controlError",
                    Description     = "This is another test.",
                    Link            = "test",
                    CodeExample     = "test",
                    IsUserExample   = false,
                    Votes           = 0,
                    Rating          = 0
                };

                await ec.PostError(controlError);

                // Act
                var response = await ec.PostError(testError);

                // Assert
                Assert.Equal("Microsoft.AspNetCore.Mvc.ConflictResult", response.ToString());
            }
        }
Esempio n. 13
0
        public async void GetAllCanReturnNullIfNoErrorsExistInDatabase()
        {
            DbContextOptions <BrokenAPIContext> options =
                new DbContextOptionsBuilder <BrokenAPIContext>()
                .UseInMemoryDatabase("GetAllDb")
                .Options;

            using (BrokenAPIContext context = new BrokenAPIContext(options))
            {
                // Arrange
                ErrorController ec = new ErrorController(context);

                // Act
                var allErrors = await ec.GetAll();

                // Assert
                Assert.Null(allErrors.Result);
            }
        }
Esempio n. 14
0
        public void GetTopCanReturnNullExceptionIfNoErrorsExistInDatabase()
        {
            DbContextOptions <BrokenAPIContext> options =
                new DbContextOptionsBuilder <BrokenAPIContext>()
                .UseInMemoryDatabase("GetTopdb")
                .Options;

            using (BrokenAPIContext context = new BrokenAPIContext(options))
            {
                // Arrange
                ErrorController ec = new ErrorController(context);

                // Act
                var response = ec.GetTop();

                // Assert
                Assert.Null(response.Exception);
            }
        }
 public ErrorCategoryController(BrokenAPIContext context)
 {
     _context = context;
 }
Esempio n. 16
0
        public static async void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new BrokenAPIContext(
                       serviceProvider.GetRequiredService <DbContextOptions <BrokenAPIContext> >()))
            {
                if (context.Errors.Any())
                {
                    return;
                }

                await context.Errors.AddRangeAsync(
                    new Error
                {
                    ErrorCategoryID = 0,
                    DetailedName    = "Unexpected Output string",
                    Link            = "https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/error-types",
                    CodeExample     =
                        "public static void Main(string[] args)\n" +
                        "{\n" +
                        "\tConsole.WriteLine(\"Hello World\");\n" +
                        "\tstring firstName = \"John\";\n" +
                        "\tstring lastName = \"Doe\";\n" +
                        "\tMakeFullName(firstName, lastName);\n" +
                        "}\n" +
                        "public static void MakeFullName(string one, string two)\n" +
                        "{\n" +
                        "\tConsole.WriteLine(one + two);  // output is JohnDoe\n" +
                        "\tConsole.WriteLine(one + \" \" + two); //Correct output of John Doe\n" +
                        "\tConsole.WriteLine($\"{one} {two}\"); // same as above\n" +
                        "}",
                    IsUserExample = false,
                    Votes         = 0,
                    Rating        = 0,
                    Description   = "Code executes but does not produce is not the expected output."
                },

                    new Error
                {
                    ErrorCategoryID = 0,
                    DetailedName    = "Unexpected Output Int",
                    Link            = "https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/error-types",
                    CodeExample     =
                        "public static void Main(string[] args)\n" +
                        "{\n" +
                        "\tConsole.WriteLine(\"Hello World\");\n" +
                        "\tConsole.WriteLine(FindAverage(20, 12));\n" +
                        "\tConsole.WriteLine(FindAverageTrue(20, 12));\n" +
                        "}\n" +
                        "public static int FindAverage(int x, int y)\n" +
                        "{\n" +
                        "\treturn x + y / 2;   // returns 26 instead of the expected output of 16\n" +
                        "}\n" +
                        "public static int FindAverageTrue(int x, int y)\n" +
                        "{\n" +
                        "\treturn (x + y) / 2;  // returned the correct output for average\n" +
                        "}",
                    IsUserExample = false,
                    Votes         = 0,
                    Rating        = 0,
                    Description   = "Code executes but does not produce is not the expected output."
                },

                    new Error
                {
                    ErrorCategoryID = 1,
                    DetailedName    = "NullReference Exception",
                    Link            = "https://docs.microsoft.com/en-us/dotnet/api/system.nullreferenceexception?view=netframework-4.7.2",
                    CodeExample     =
                        "public static void Main(String[] args)\n" +
                        "{\n" +
                        "\tStack myStack = new Stack();\n" +
                        "\tFindTopOfStack(myStack);\n" +
                        "}\n" +
                        "public static Node FindTopOfStack(Stack inputStack)\n" +
                        "{\n" +
                        "\tNode formerTop = inputStack.Pop();\n" +
                        "\treturn formerTop;\n" +
                        "}",
                    IsUserExample = false,
                    Votes         = 0,
                    Rating        = 0,
                    Description   = "Error occurs when a method is passed a null argument, " +
                                    "and is unable to handle null input. This Error typically " +
                                    "causes the application to stop functioning."
                },

                    new Error
                {
                    ErrorCategoryID = 1,
                    DetailedName    = "DivideByZero Exception",
                    Link            = "https://msdn.microsoft.com/en-us/library/system.dividebyzeroexception(v=vs.110).aspx",
                    CodeExample     =
                        "public static void Main(String[] args)\n" +
                        "{\n" +
                        "\tint quotient = 5 / 0;\n" +
                        "\tConsole.WriteLine(quotient)\n" +
                        "}",
                    IsUserExample = false,
                    Votes         = 1,
                    Rating        = 0,
                    Description   = "Error occurs when trying to divide a number by zero. " +
                                    "Since this is mathematically impossible, this error typically " +
                                    "causes the application to stop functioning."
                },

                    new Error
                {
                    ErrorCategoryID = 2,
                    DetailedName    = "Invalid Assignment",
                    CodeExample     =
                        "public static void Main(String[] args)\n" +
                        "{\n" +
                        "\tif (x = y)\n" +
                        "\t{\n" +
                        "\t\tConsole.WriteLine(x)\n" +
                        "\t}\n" +
                        "}",
                    IsUserExample = false,
                    Votes         = 0,
                    Rating        = 0,
                    Description   = "Error occurs when erroneously attempting to assign " +
                                    "values when doing a comparison, such as in an \"if statement\"."
                },

                    new Error
                {
                    ErrorCategoryID = 2,
                    DetailedName    = "Missing Parenthesis",
                    CodeExample     =
                        "public static void Main(String[] args)\n" +
                        "{\n" +
                        "\tb = (4 + 6;  // missing closing parenthesis, ')' expected\n" +
                        "}",
                    IsUserExample = false,
                    Votes         = 0,
                    Rating        = 0,
                    Description   = "Error caused by not providing an opening or " +
                                    "closing parenthesis to a statement."
                },

                    new Error
                {
                    ErrorCategoryID = 2,
                    DetailedName    = "missing argument",
                    Link            = "https://msdn.microsoft.com/en-us/library/system.argumentexception(v=vs.110).aspx",
                    CodeExample     =
                        "public static void Main(String[] args)\n" +
                        "{\n" +
                        "\tb = 5 + * 9;   // missing argument between + and *\n" +
                        "}",
                    IsUserExample = false,
                    Votes         = 0,
                    Rating        = 0,
                    Description   = "Missing and operand between two operators " +
                                    "(addition and multiplication signs)."
                },

                    new Error
                {
                    ErrorCategoryID = 2,
                    DetailedName    = "Invalid Initializer",
                    CodeExample     =
                        "public static void Main(String[] args)\n" +
                        "{\n" +
                        "\ti++ // use of undefined local variable 'i'\n" +
                        "}",
                    IsUserExample = false,
                    Votes         = 0,
                    Rating        = 0,
                    Description   = "Error caused when attempting to perform on operation " +
                                    "using a variable which has not been previously declared."
                },

                    new Error
                {
                    ErrorCategoryID = 2,
                    DetailedName    = "Type Incompatibility",
                    Link            = "https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/types/casting-and-type-conversions",
                    CodeExample     =
                        "public static void Main(String[] args)\n" +
                        "{\n" +
                        "\tint x = \"John\";  // Cannot implicitly convert type 'string' to 'int'\n" +
                        "}",
                    IsUserExample = false,
                    Votes         = 0,
                    Rating        = 0,
                    Description   = "Variables of different Types, such as \"string\" and \"int\", " +
                                    "are not able to be converted implicitly."
                },

                    new Error
                {
                    ErrorCategoryID = 1,
                    DetailedName    = "IndexOutOfRange Exception",
                    Link            = "https://docs.microsoft.com/en-us/dotnet/api/system.indexoutofrangeexception?view=netframework-4.7.1",
                    CodeExample     =
                        "public static void Main(String[] args)\n" +
                        "{\n" +
                        "\tint[] myarray = new int[5];\n" +
                        "\tmyarray[10] = 10;\n" +
                        "}",
                    IsUserExample = false,
                    Votes         = 0,
                    Rating        = 0,
                    Description   = "Error caused when trying to access an index outside of the range " +
                                    "specified by the size of an array."
                },

                    new Error
                {
                    ErrorCategoryID = 0,
                    DetailedName    = "Infinite Loop",
                    CodeExample     =
                        "public static void Main(String[] args)\n" +
                        "{\n" +
                        "\tint x = 1; \n" +
                        "\twhile (x == 1)\n" +
                        "\t{\n" +
                        "\t\tConsole.WriteLine(x);\n" +
                        "\t}\n" +
                        "}",
                    IsUserExample = false,
                    Votes         = 0,
                    Rating        = 0,
                    Description   = "Inifite loops are caused when a condition is never mutated, in order " +
                                    "to return \"false\" and exit the loop. This will cause the loop to run " +
                                    "continuously, typically causes the system to freeze as a result."
                },

                    new Error
                {
                    ErrorCategoryID = 1,
                    DetailedName    = "FileNotFound Exception",
                    Link            = "https://docs.microsoft.com/en-us/dotnet/api/system.io.filenotfoundexception?view=netframework-4.7.1",
                    CodeExample     =
                        "public static void Main(String[] args)\n" +
                        "{\n" +
                        "\tusing (StreamReader sr = new StreamReader(path: \"../example.txt\"));\n" +
                        "}",
                    IsUserExample = false,
                    Votes         = 0,
                    Rating        = 0,
                    Description   = "This error is caused when attempting to access a file that " +
                                    "does not exist at the specified path.",
                },

                    new Error
                {
                    ErrorCategoryID = 2,
                    DetailedName    = "Missing Semicolon",
                    CodeExample     =
                        "public static void Main(String[] args)\n" +
                        "{\n" +
                        "\t int a = 5   // semicolon is missing, ';' expected\n" +
                        "}",
                    IsUserExample = false,
                    Votes         = 0,
                    Rating        = 0,
                    Description   = "Common syntax error which occurs when a semicolon is not added " +
                                    "at the end of a statement.",
                });

                await context.SaveChangesAsync();
            }
        }
Esempio n. 17
0
        public async void GetAllCanReturnAllErrorsInDatabase()
        {
            DbContextOptions <BrokenAPIContext> options =
                new DbContextOptionsBuilder <BrokenAPIContext>()
                .UseInMemoryDatabase("GetAllDb")
                .Options;

            using (BrokenAPIContext context = new BrokenAPIContext(options))
            {
                // Arrange
                ErrorController ec = new ErrorController(context);

                Error errorOne = new Error
                {
                    ErrorCategoryID = 0,
                    DetailedName    = "errorOne",
                    Description     = "This is a test.",
                    Link            = "test",
                    CodeExample     = "test",
                    IsUserExample   = false,
                    Votes           = 0,
                    Rating          = 0
                };

                Error errorTwo = new Error
                {
                    ErrorCategoryID = 0,
                    DetailedName    = "errorTwo",
                    Description     = "This is a test.",
                    Link            = "test",
                    CodeExample     = "test",
                    IsUserExample   = false,
                    Votes           = 0,
                    Rating          = 0
                };

                Error errorThree = new Error
                {
                    ErrorCategoryID = 0,
                    DetailedName    = "errorThree",
                    Description     = "This is a test.",
                    Link            = "test",
                    CodeExample     = "test",
                    IsUserExample   = false,
                    Votes           = 0,
                    Rating          = 0
                };

                await context.Errors.AddAsync(errorOne);

                await context.Errors.AddAsync(errorTwo);

                await context.Errors.AddAsync(errorThree);

                await context.SaveChangesAsync();

                // Act
                var allErrors = ec.GetAll();

                // Assert
                Assert.Equal(3, allErrors.Result.Value.Count());
            }
        }