public void ShouldAddDriverByName()
        {
            //arrange
            var context = new InMemoryDataContext();
            var service = new DriversEducationService(new Repository(context));

            //act
            service.AddDriver("Devlin");

            //assert
            context.AsQueryable<Driver>().Count(x => x.LastName == "Devlin").Should().Be(1);
        }
示例#2
0
        public void ShouldAddDriverByName()
        {
            //arrange
            var context = new InMemoryDataContext();
            var service = new DriversEducationService(new Repository(context));

            //act
            service.AddDriver("Devlin");
            context.Commit();

            //assert
            context.AsQueryable <Driver>().Count(x => x.LastName == "Devlin").Should().Be(1);
        }
        public void ShouldQueryDriversByName()
        {
            //arrange 
            var context = new InMemoryDataContext();
            context.Add(new Driver("Devlin", "Liles"));
            context.Add(new Driver("Tim", "Rayburn"));

            var service = new DriversEducationService(new Repository(context));

            //act
            Driver driver = service.GetDriver("Liles");

            //assert
            driver.Should().NotBeNull();
        }
示例#4
0
        public void ShouldQueryDriversByName()
        {
            //arrange
            var context = new InMemoryDataContext();

            context.Add(new Driver("Devlin", "Liles"));
            context.Add(new Driver("Tim", "Rayburn"));
            context.Commit();

            var service = new DriversEducationService(new Repository(context));

            //act
            Driver driver = service.GetDriver("Liles");

            //assert
            driver.Should().NotBeNull();
        }