public void GetAllAddressesCase()
        {
            var okResult = _controller.GetAddresses();
            var items    = Assert.IsAssignableFrom <IEnumerable <Address> >(okResult).Count();

            Assert.Equal(3, items);
        }
        public void GetAddressesTest()
        {
            // Arrange
            AddressController controller = new AddressController();

            // Act
            IEnumerable <Address> result = controller.GetAddresses();

            // Assert
            Assert.IsNotNull(result);
            //Assert.AreEqual(2, result.Count());
            //Assert.AreEqual("value1", result.ElementAt(0));
            //Assert.AreEqual("value2", result.ElementAt(1));
        }
Пример #3
0
        public void TestGetAddresses()
        {
            // db is empty
            using (var context = new ProTickDatabaseContext(dbOptions))
            {
                var dbm       = new DatabaseQueryManager(context);
                var converter = new ResourceDTOConverter(dbm);

                var controller = new AddressController(context, converter, dbm);

                var actual = controller.GetAddresses().ToList().Count;

                int expected = 0;

                Assert.Equal(expected, actual);
            }

            // seeding DB
            using (var context = new ProTickDatabaseContext(dbOptions))
            {
                DbContextSeeder.SeedFull(context);
            }

            // db is Test-Ready
            using (var context = new ProTickDatabaseContext(dbOptions))
            {
                var dbm       = new DatabaseQueryManager(context);
                var converter = new ResourceDTOConverter(dbm);

                var controller = new AddressController(context, converter, dbm);

                var actual = controller.GetAddresses().ToList();

                var expected = DbContextSeeder.GetSeededAddressDTOs(
                    3
                    )
                               .ToList();

                Assert.Equal(expected.Count, actual.Count);

                expected.Should().BeEquivalentTo(actual);
            }
        }
 public IEnumerable <Address> GetAddresses()
 {
     return((List <Address>)AC.GetAddresses());
 }