コード例 #1
0
        public void NoConverter()
        {
            var mapping = new SimpleColumnMapping<User>(x => x.FirstName, "first_name", null);
            var dataRecord = Substitute.For<IDataRecord>();
            dataRecord["first_name"].Returns("arne");
            var actual = new User();

            mapping.SetValue(dataRecord, actual);

            Assert.Equal("arne", actual.FirstName);
        }
コード例 #2
0
        public void NoConverter()
        {
            var mapping    = new SimpleColumnMapping <User>(x => x.FirstName, "first_name", null);
            var dataRecord = Substitute.For <IDataRecord>();

            dataRecord["first_name"].Returns("arne");
            var actual = new User();

            mapping.SetValue(dataRecord, actual);

            Assert.Equal("arne", actual.FirstName);
        }
コード例 #3
0
        public void CallingConverter()
        {
            var converter = Substitute.For<IColumnConverter>();
            converter.Convert("arne").Returns("Arne");
            var mapping = new SimpleColumnMapping<User>(x => x.FirstName, "first_name", converter);
            var dataRecord = Substitute.For<IDataRecord>();
            dataRecord["first_name"].Returns("arne");
            var actual = new User();

            mapping.SetValue(dataRecord, actual);

            Assert.Equal("Arne", actual.FirstName);
            converter.Received().Convert("arne");
        }
コード例 #4
0
        public void CallingConverter()
        {
            var converter = Substitute.For <IColumnConverter>();

            converter.Convert("arne").Returns("Arne");
            var mapping    = new SimpleColumnMapping <User>(x => x.FirstName, "first_name", converter);
            var dataRecord = Substitute.For <IDataRecord>();

            dataRecord["first_name"].Returns("arne");
            var actual = new User();

            mapping.SetValue(dataRecord, actual);

            Assert.Equal("Arne", actual.FirstName);
            converter.Received().Convert("arne");
        }