示例#1
0
        public void Test_GetQueryableMockDbSet_Empty()
        {
            var fakeTableDbSet = MockDbSet.GetQueryableMockDbSet <FakeTable>(@"");

            _dataContext.Setup(d => d.FakeTables).Returns(fakeTableDbSet.Object);
            Assert.IsNotNull(_dataContext.Object.FakeTables);
        }
示例#2
0
        public void Test_GetQueryableMockDbSet_With_Json()
        {
            var fakeTableDbSet = MockDbSet.GetQueryableMockDbSet <FakeTable>(@"test-data.json");

            _dataContext.Setup(d => d.FakeTables).Returns(fakeTableDbSet.Object);
            Assert.IsNotNull(_dataContext.Object.FakeTables);
            Assert.AreEqual(_dataContext.Object.FakeTables.First().Name, "test-name");
        }
示例#3
0
        public void Test_GetQueryableMockDbSet_With_Enumerable_Objects()
        {
            var fakeTableDbSet = MockDbSet.GetQueryableMockDbSet <FakeTable>(new List <FakeTable>()
            {
                new FakeTable()
                {
                    Id   = 2,
                    Name = "test-object"
                }
            });

            _dataContext.Setup(d => d.FakeTables).Returns(fakeTableDbSet.Object);
            Assert.IsNotNull(_dataContext.Object.FakeTables);
            Assert.AreEqual(_dataContext.Object.FakeTables.First().Name, "test-object");
            Assert.AreEqual(_dataContext.Object.FakeTables.Count(), 1);
        }