Beispiel #1
0
        public async Task GetCakeToEdit_WithInValidCakeId_ShouldThrow()
        {
            //Assert
            var db = this.SetDb();

            await this.SeedProducts(db);

            var repo = new Repository <Product>(db);

            var service = new CakeService(null, repo, this.Mapper);

            //Act

            //Assert
            await Assert.ThrowsAsync <NullReferenceException>(async() => await service.GetCakeToEdit(3));
        }
Beispiel #2
0
        public async Task GetCakeToEdit_WithValidCakeId_ShouldReturnProduct()
        {
            //Assert
            var db = this.SetDb();

            await this.SeedProducts(db);

            var repo = new Repository <Product>(db);

            var service = new CakeService(null, repo, this.Mapper);

            //Act
            var result = await service.GetCakeToEdit(2);

            var expectedCakeId = 2;
            var acutalCakeId   = result.Id;

            //Assert
            Assert.Equal(expectedCakeId, acutalCakeId);
        }