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

            await this.SeedDataAsync(context);

            var roadObjectService = new RoadObjectService(context);

            await roadObjectService.GetByIdAsync(1);

            var expectedResult = "RON 1";
            var actualResult   = await roadObjectService.GetByIdAsync(1);

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

            await this.SeedDataAsync(context);

            var roadObjectService = new RoadObjectService(context);

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