Example #1
0
        public async void GetById_WhenNonExistent_ShouldReturnNull()
        {
            //arrange
            _context.Database.EnsureCreated();
            var differenceLeftRepository = new DifferenceLeftRepository(_context);
            int id = 1;

            //Act
            var differenceReturned = await differenceLeftRepository.GetById(id);

            //Assert
            Assert.Null(differenceReturned);
        }
Example #2
0
        public async void GetById_WhenProperlySaved_ShouldReturnEqualValues()
        {
            //arrange
            _context.Database.EnsureCreated();
            var differenceLeftRepository = new DifferenceLeftRepository(_context);
            int id = 1;

            //Act
            var differenceSaved = new DifferenceLeft(id, "a");

            differenceLeftRepository.Add(differenceSaved);

            var differenceReturned = await differenceLeftRepository.GetById(id);


            //Assert
            Assert.Equal <Difference>(differenceSaved, differenceReturned);
        }