public void BranchesController_GetBranch_OK() { // Arrange var controller = new BranchesController(repo); var branchNumber = 102; // Act var result = controller.GetBranch(branchNumber) as OkNegotiatedContentResult <Branch>; // Assert Assert.IsNotNull(result, "Controller returned null data"); Assert.AreEqual(repo.GetBranchByNumber(branchNumber).Name, result.Content.Name); }
public void BranchRepository_GetBranchByNumber_NotFound() { // Arrange TestJsonDataService json = new TestJsonDataService(); BranchRepository repo = new BranchRepository(json); int testID = 999; // Act var branchItem = repo.GetBranchByNumber(testID); // Assert Assert.IsNull(branchItem, "GetBranchByNumber returned null data"); }
public void BranchRepository_GetBranchByNumber_OK() { // Arrange TestJsonDataService json = new TestJsonDataService(); BranchRepository repo = new BranchRepository(json); int testID = 102; // Act var branchItem = repo.GetBranchByNumber(testID); // Assert Assert.IsNotNull(branchItem, "GetBranchByNumber returned null data"); Assert.AreEqual(testID, branchItem.Number, "GetBranchByNumber returned wrong record"); }