public void MappingAdoQueryWithContextWithoutParams() { IDataReader reader = MockRepository.GenerateMock<IDataReader>(); reader.Stub(x => x.Read()).Return(true).Repeat.Once(); reader.Stub(x => x.GetInt32(0)).Return(1).Repeat.Once(); reader.Stub(x => x.Read()).Return(false).Repeat.Once(); command.Stub(x => x.ExecuteReader()).Return(reader); IntMappingQueryWithContext queryWithNoContext = new IntMappingQueryWithContext(provider); queryWithNoContext.Compile(); IList list = queryWithNoContext.QueryByNamedParam(null, null); Assert.IsTrue(list.Count != 0); foreach (int count in list) { Assert.AreEqual(1, count); } }
public void MappingAdoQueryWithContextWithoutParams() { IDataReader reader = A.Fake <IDataReader>(); A.CallTo(() => reader.Read()).Returns(true).Once().Then.Returns(false); A.CallTo(() => reader.GetInt32(0)).Returns(1).Once(); A.CallTo(() => command.ExecuteReader()).Returns(reader); IntMappingQueryWithContext queryWithNoContext = new IntMappingQueryWithContext(provider); queryWithNoContext.Compile(); IList list = queryWithNoContext.QueryByNamedParam(null, null); Assert.IsTrue(list.Count != 0); foreach (int count in list) { Assert.AreEqual(1, count); } }
public void MappingAdoQueryWithContextWithoutParams() { IDataReader reader = MockRepository.GenerateMock <IDataReader>(); reader.Stub(x => x.Read()).Return(true).Repeat.Once(); reader.Stub(x => x.GetInt32(0)).Return(1).Repeat.Once(); reader.Stub(x => x.Read()).Return(false).Repeat.Once(); command.Stub(x => x.ExecuteReader()).Return(reader); IntMappingQueryWithContext queryWithNoContext = new IntMappingQueryWithContext(provider); queryWithNoContext.Compile(); IList list = queryWithNoContext.QueryByNamedParam(null, null); Assert.IsTrue(list.Count != 0); foreach (int count in list) { Assert.AreEqual(1, count); } }
public void MappingAdoQueryWithContextWithoutParams() { IDataReader reader = (IDataReader)mocks.DynamicMock(typeof(IDataReader)); Expect.Call(reader.Read()).Return(true); Expect.Call(reader.GetInt32(0)).Return(1); Expect.Call(reader.Read()).Return(false); Expect.Call(command.ExecuteReader()).Return(reader); mocks.ReplayAll(); IntMappingQueryWithContext queryWithNoContext = new IntMappingQueryWithContext(provider); queryWithNoContext.Compile(); IList list = queryWithNoContext.QueryByNamedParam(null, null); Assert.IsTrue(list.Count != 0); foreach (int count in list) { Assert.AreEqual(1, count); } mocks.VerifyAll(); }
public void MappingAdoQueryWithContextWithoutParams() { IDataReader reader = (IDataReader)mocks.DynamicMock(typeof(IDataReader)); Expect.Call(reader.Read()).Return(true); Expect.Call(reader.GetInt32(0)).Return(1); Expect.Call(reader.Read()).Return(false); Expect.Call(command.ExecuteReader()).Return(reader); mocks.ReplayAll(); IntMappingQueryWithContext queryWithNoContext = new IntMappingQueryWithContext(provider); queryWithNoContext.Compile(); IList list = queryWithNoContext.QueryByNamedParam(null, null); Assert.IsTrue(list.Count != 0); foreach (int count in list) { Assert.AreEqual(1, count); } mocks.VerifyAll(); }