Exemplo n.º 1
0
        public void TestBaseRepositoryOthersNullCrud()
        {
            // Setup
            var entity = new OthersClass
            {
                SessionId              = Guid.NewGuid(),
                ColumnHierarchyId      = null,
                ColumnSqlVariant       = null,
                ColumnUniqueIdentifier = null,
                ColumnXml              = null
            };

            using (var repository = new OthersClassRepository(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.ColumnHierarchyId);
                Assert.IsNull(data.ColumnSqlVariant);
                Assert.IsNull(data.ColumnUniqueIdentifier);
                Assert.IsNull(data.ColumnXml);
            }
        }
Exemplo n.º 2
0
        public void TestBaseRepositoryOthersCrud()
        {
            // Setup
            var entity = new OthersClass
            {
                SessionId              = Guid.NewGuid(),
                ColumnHierarchyId      = "/",
                ColumnSqlVariant       = "This is variant!",
                ColumnUniqueIdentifier = Guid.NewGuid(),
                ColumnXml              = "<xml><person><id>1</id><name>Michael</name></person><person><id>2</id><name>RepoDb</name></person></xml>"
            };

            using (var repository = new OthersClassRepository(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.ColumnHierarchyId.ToString(), data.ColumnHierarchyId?.ToString());
                Assert.AreEqual(entity.ColumnSqlVariant, data.ColumnSqlVariant);
                Assert.AreEqual(entity.ColumnUniqueIdentifier, data.ColumnUniqueIdentifier);
                Assert.AreEqual(entity.ColumnXml, data.ColumnXml);
            }
        }