Beispiel #1
0
        public void TestBaseRepositoryStringsMappedNullCrud()
        {
            // Setup
            var entity = new StringsMapClass
            {
                SessionId            = Guid.NewGuid(),
                ColumnCharMapped     = null,
                ColumnNCharMapped    = null,
                ColumnNTextMapped    = null,
                ColumnNVarCharMapped = null,
                ColumnTextMapped     = null,
                ColumnVarCharMapped  = null
            };

            using (var repository = new StringsMapClassRepository(Database.ConnectionStringForRepoDb))
            {
                // Act Insert
                var id = repository.Insert(entity);

                // Act Query
                var data = repository.Query(e => e.SessionId == (Guid)id).FirstOrDefault();

                // Assert
                Assert.IsNotNull(data);
                Assert.IsNull(data.ColumnCharMapped);
                Assert.IsNull(data.ColumnNCharMapped);
                Assert.IsNull(data.ColumnNTextMapped);
                Assert.IsNull(data.ColumnNVarCharMapped);
                Assert.IsNull(data.ColumnTextMapped);
                Assert.IsNull(data.ColumnVarCharMapped);
            }
        }
Beispiel #2
0
        public void TestBaseRepositoryStringsMappedCrud()
        {
            // Setup
            var text   = Helper.GetUnicodeString();
            var entity = new StringsMapClass
            {
                SessionId            = Guid.NewGuid(),
                ColumnCharMapped     = text,
                ColumnNCharMapped    = text,
                ColumnNTextMapped    = text,
                ColumnNVarCharMapped = text,
                ColumnTextMapped     = text,
                ColumnVarCharMapped  = text
            };

            using (var repository = new StringsMapClassRepository(Database.ConnectionStringForRepoDb))
            {
                // Act Insert
                var id = repository.Insert(entity);

                // Act Query
                var data = repository.Query(e => e.SessionId == (Guid)id).FirstOrDefault();

                // Assert
                Assert.IsNotNull(data);
                Assert.AreEqual(entity.ColumnCharMapped, data.ColumnCharMapped.Trim());
                Assert.AreEqual(entity.ColumnNCharMapped, data.ColumnNCharMapped.Trim());
                Assert.AreEqual(entity.ColumnNTextMapped, data.ColumnNTextMapped);
                Assert.AreEqual(entity.ColumnNVarCharMapped, data.ColumnNVarCharMapped);
                Assert.AreEqual(entity.ColumnTextMapped, data.ColumnTextMapped);
                Assert.AreEqual(entity.ColumnVarCharMapped, data.ColumnVarCharMapped);
            }
        }