public void FindByIdTest() { //Arrange Book entityWait = entity; entityDto = null; bookRepository.FindById(Arg.Any <long>()).Returns(entity); //Act entityDto = bookServices.FindById(1); //Assert Assert.AreEqual(entityDto.Id, entityWait.Id); }
public void Initialize() { Mapper.Reset(); MappingConfig.Initialize(); bookRepository = Substitute.For <IBookRepository>(); bookServices = new BookService(bookRepository); entity = new Book { Name = "Book 1", Amount = 1, Price = 1 }; entityDto = Mapper.Map <Dtos.Book>(entity); entitiesWait = new List <Book>(); }
public async Task FindByIdAsyncTest() { //Arrange Book entityWait = entity; entityDto = null; bookRepository.FindByIdAsync(Arg.Any <long>()).Returns(entity); //Act entityDto = await bookServices.FindByIdAsync(1); //Assert Assert.AreEqual(entityDto.Id, entityWait.Id); }