Beispiel #1
0
        public async void get_should_return_with_app()
        {
            //arrange 
            var appRepository = new Mock<IRepository<App>>();
            appRepository.Setup(x => x.FindOne(It.IsAny<Expression<Func<App, bool>>>(), It.IsAny<Expression<Func<App, object>>>())).Returns(new App());

            //act
            var sut = new AppServiceBuilder().WithAppRepository(appRepository.Object)
                                             .Build();
            var entity = await sut.Get(1);

            //assert
            Assert.NotNull(entity);
            Assert.IsAssignableFrom<App>(entity);

            appRepository.Verify(x => x.FindOne(It.IsAny<Expression<Func<App, bool>>>(), It.IsAny<Expression<Func<App, object>>>()), Times.Once);
        }