Example #1
0
        public async Task GetByIdAsync_ShouldSuccessfullyGet()
        {
            MapperInitializer.InitializeMapper();
            var context = ApplicationDbContextInMemoryFactory.InitializeContext();

            await this.SeedDataAsync(context);

            var asphaltMixtureService = new AsphaltMixtureService(context);

            await asphaltMixtureService.GetByIdAsync(1);

            var expectedResult = "AMT 1";
            var actualResult   = await asphaltMixtureService.GetByIdAsync(1);

            Assert.True(expectedResult == actualResult.Type);
        }
Example #2
0
        public async Task GetByIdAsync_WithNonExistingId_ShouldThrowArgumentNullException()
        {
            MapperInitializer.InitializeMapper();
            var context = ApplicationDbContextInMemoryFactory.InitializeContext();

            await this.SeedDataAsync(context);

            var asphaltMixtureService = new AsphaltMixtureService(context);

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