Exemplo n.º 1
0
        public async Task GetByIdAsync_ShouldSuccessfullyGet()
        {
            MapperInitializer.InitializeMapper();
            var context = ApplicationDbContextInMemoryFactory.InitializeContext();

            await this.SeedDataAsync(context);

            var driverService = new DriverService(context);

            await driverService.GetByIdAsync(1);

            var expectedResult = "DFN 1";
            var actualResult   = await driverService.GetByIdAsync(1);

            Assert.True(expectedResult == actualResult.FullName);
        }
Exemplo n.º 2
0
        public async Task GetByIdAsync_WithNonExistingId_ShouldThrowArgumentNullException()
        {
            MapperInitializer.InitializeMapper();
            var context = ApplicationDbContextInMemoryFactory.InitializeContext();

            await this.SeedDataAsync(context);

            var driverService = new DriverService(context);

            await Assert.ThrowsAsync <ArgumentNullException>(async() =>
            {
                await driverService.GetByIdAsync(3);
            });
        }