Ejemplo n.º 1
0
        public void ReturnCollectionOf10NewestBarsOrderedAscending()
        {
            // Arrange
            var options = TestUtilities.GetOptions(nameof(ReturnCollectionOf10NewestBarsOrderedAscending));


            // Act, Assert
            using (var assertContext = new CocktailDB(options))
            {
                var sut  = new BarServices(assertContext);
                var bar1 = new Bar
                {
                    Name      = "FF1",
                    CreatedOn = DateTime.Now
                };
                var bar2 = new Bar
                {
                    Name      = "FF2",
                    CreatedOn = DateTime.Now
                };

                assertContext.Bars.Add(bar1);
                assertContext.Bars.Add(bar2);
                assertContext.SaveChanges();

                var result = sut.LoadNewestBars().GetAwaiter().GetResult();

                Assert.IsTrue(result.Count == 2 && result[0] == bar1 && result[1] == bar2);
            }
        }
Ejemplo n.º 2
0
        public void ReturnEmptyCollectionIfThereAreNoBars()
        {
            // Arrange
            var options = TestUtilities.GetOptions(nameof(ReturnEmptyCollectionIfThereAreNoBars));

            // Act, Assert
            using (var assertContext = new CocktailDB(options))
            {
                var sut    = new BarServices(assertContext);
                var result = sut.LoadNewestBars().GetAwaiter().GetResult();

                Assert.IsTrue(result.Count == 0);
            }
        }