Beispiel #1
0
        public void BranchesController_GetBranches_OK()
        {
            // Arrange
            var controller = new BranchesController(repo);

            // Act
            var result = controller.GetBranches();

            // Assert
            Assert.IsNotNull(result, "Controller returned null data");
            Assert.AreEqual(repo.GetAll().Count(), result.Count());
        }
Beispiel #2
0
        public void TestMethodGetList()
        {
            var context = new TestBankDBContext();

            context.Branches.Add(new Branch {
                Id = 1, Name = "BPD", Street = "Av. Lope de Vega", ZipCode = "78451", BankId = 1, UserId = 1, CreatedOn = DateTime.Now
            });
            context.Branches.Add(new Branch {
                Id = 2, Name = "BHD", Street = "Av. Lope de Vega", ZipCode = "78458", BankId = 2, UserId = 1, CreatedOn = DateTime.Now
            });
            context.Branches.Add(new Branch {
                Id = 3, Name = "Banreservas", Street = "Av. Lope de Vega", ZipCode = "78457", BankId = 3, UserId = 1, CreatedOn = DateTime.Now
            });

            var controller = new BranchesController(context);
            var result     = controller.GetBranches() as TestBranchDbSet;

            Assert.IsNotNull(result);
            Assert.AreEqual(3, result.Local.Count);
        }