This repository has been archived by the owner on Oct 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from NCAR/Tests
Addition of tests for the controllers and code coverage report
- Loading branch information
Showing
320 changed files
with
62,614 additions
and
379 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using MySqlConnector; | ||
|
||
namespace Chemistry_Cafe_API.Tests | ||
{ | ||
public class DBConnection | ||
{ | ||
public static MySqlDataSource DataSource = new MySqlDataSource("Server=chemisty-cafe.cl8uuceq2rud.us-east-1.rds.amazonaws.com;User ID=cafeadmin;Password=cafeadmin;Port=3306;Database=Testing"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using Chemistry_Cafe_API.Controllers; | ||
using Chemistry_Cafe_API.Models; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using MySqlConnector; | ||
|
||
namespace Chemistry_Cafe_API.Tests | ||
{ | ||
[TestClass] | ||
public class FamilyControllerTests | ||
{ | ||
FamilyController controller = new FamilyController(DBConnection.DataSource); | ||
|
||
[TestMethod] | ||
public async Task Get_retrieves_family() | ||
{ | ||
|
||
var result = await controller.Get() as List<Family>; | ||
|
||
Assert.IsNotNull(result); | ||
} | ||
|
||
[TestMethod] | ||
public async Task Creates_family() | ||
{ | ||
|
||
var result = await controller.Create("Test") ; | ||
|
||
var getResult = await controller.Get(result.uuid); | ||
|
||
Assert.AreEqual(result.uuid, getResult.uuid); | ||
} | ||
|
||
[TestMethod] | ||
public async Task Updates_family() | ||
{ | ||
|
||
var result = await controller.Create("Test"); | ||
|
||
result.name = "Edited"; | ||
|
||
await controller.Put(result); | ||
|
||
var getResult = await controller.Get(result.uuid); | ||
|
||
await controller.Delete(result.uuid); | ||
|
||
Assert.AreEqual(result.name, "Edited"); | ||
} | ||
} | ||
} |
Oops, something went wrong.