public void GetReasonById_WrongId_ReturnsNull() { // Use a clean instance of the context to run the test using (var context = new ReasonContext(_options)) { ReasonRepository reasonRepository = new ReasonRepository(context); //act var reason = reasonRepository .GetReasonById(5, _userId1); //assert Assert.Null(reason); } }
public void GetReasonById_WrongUserId_ReturnsNull() { // Use a clean instance of the context to run the test using (var context = new ReasonContext(_options)) { ReasonRepository reasonRepository = new ReasonRepository(context); //act var userId = "487f83a4-7e64-4c7f-9330-197b48549ee3"; var reason = reasonRepository .GetReasonById(1, userId); //assert Assert.Null(reason); } }
public void GetReasonById(int id, string userId, string text) { // Use a clean instance of the context to run the test using (var context = new ReasonContext(_options)) { ReasonRepository reasonRepository = new ReasonRepository(context); //act var reason = reasonRepository .GetReasonById(id, userId); var isTrue = reason.Text.Contains(text); //assert Assert.True(isTrue); Assert.Equal(reason.UserId, userId); } }
public Mst_Reason GetReasonById(int id) { var source = _reasonRepository.GetReasonById(id); return(source); }