Ejemplo n.º 1
0
        public async Task ShouldGetById()
        {
            var repo      = new FundManagerMemoryDb();
            var firstItem = (await repo.GetAll()).First();

            var result = await repo.GetBy(firstItem.Id);

            Assert.That(result, Is.EqualTo(firstItem));
        }
Ejemplo n.º 2
0
        public async Task ShouldGetItems()
        {
            var repo = new FundManagerMemoryDb();

            var result = await repo.GetAll();

            //assert we have some data
            Assert.That(result.Count(), Is.GreaterThan(3));
        }
Ejemplo n.º 3
0
        public async Task ShouldUpdateItem()
        {
            var repo      = new FundManagerMemoryDb();
            var firstItem = (await repo.GetAll()).First();

            firstItem.Name = "NewName";
            repo.Update(firstItem.Id, firstItem);

            Assert.That((await repo.GetBy(firstItem.Id)).Name, Is.EqualTo("NewName"));
        }
        public async Task ShouldGetItems()
        {
            //Arrange
            var repo = new FundManagerMemoryDb();

            //Act
            var result = await repo.GetAll();

            //Assert
            Assert.That(result.Count(), Is.GreaterThan(3));
        }
Ejemplo n.º 5
0
        public async Task ShouldRemoveItem()
        {
            var repo         = new FundManagerMemoryDb();
            var fundManagers = (await repo.GetAll());
            var beforeCount  = fundManagers.Count();
            var firstItem    = fundManagers.First();

            repo.Delete(firstItem.Id);

            var afterCount = (await repo.GetAll()).Count();

            Assert.That(afterCount, Is.EqualTo(beforeCount - 1));
        }
Ejemplo n.º 6
0
        public async Task ShouldAddItem()
        {
            var repo        = new FundManagerMemoryDb();
            var beforeCount = (await repo.GetAll()).Count();
            var fundManager = new FundManager()
            {
                Name         = "TestFundManager",
                Biography    = "test bio",
                Location     = Location.NewYork,
                ManagedSince = DateTime.Now.AddYears(-1)
            };

            repo.Create(fundManager);

            Assert.That(fundManager.Id, Is.Not.EqualTo(Guid.Empty));
            var afterCount = (await repo.GetAll()).Count();

            Assert.That(afterCount, Is.EqualTo(beforeCount + 1));
        }