public IEnumerable <string> Get() { var repo = new DemoRepo(); repo.AddValue(DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss.fff")); return(repo.GetValues()); }
public void DbContextMock() { IQueryable <User> data = GetMockUsers(); var mockUser = SetDatabase <User>(data); var context = new Mock <DemoContext>(); context.Setup(s => s.Users).Returns(mockUser.Object); var demoRpo = new DemoRepo(context: context.Object); var result = demoRpo.GetById(1); Assert.Equal(1, result.Id); Assert.True(false == result.IsActive); }