コード例 #1
0
        public async void GetAll_ReturnsData()
        {
            // arrange
            ICommandFactory <Make> commandFactory = new CommandFactory <Make>();
            var validationServiceMoq = new Mock <IValidationService>();

            var sut = new MakeService(context, commandFactory, validationServiceMoq.Object);

            // act
            var result = await sut.GetAll();

            // assert
            Assert.NotEmpty(result.Data);
        }
コード例 #2
0
        public async void GetAll_WhenNotFoundReturnsNotFound()
        {
            // arrange
            var allMake = await context.Set <Make>().ToListAsync();

            ICommandFactory <Make> commandFactory = new CommandFactory <Make>();
            var validationServiceMoq = new Mock <IValidationService>();

            var sut = new MakeService(context, commandFactory, validationServiceMoq.Object);

            context.Makes.RemoveRange(allMake);
            await context.SaveChangesAsync();

            // act
            var result = await sut.GetAll();

            // assert
            Assert.Equal(ResultCode.NotFound, result.ResultCode);
        }