Exemplo n.º 1
0
        public void GetIdFromNameExceptionTest()
        {
            var id    = HelperObjectFactory.GetRandomInt(0, 100);
            var value = new IdentifyingInfo
            {
                Id = id
            };

            var parameters = new List <SQLiteParameter>();
            var table      = new ArtistTable();

            Assert.That(() => table.GetIdFromNameSql(value, ref parameters), Throws.ArgumentException);
        }
Exemplo n.º 2
0
        public void GetIdFromNameTest()
        {
            var value = new IdentifyingInfo
            {
                Name = StringExtensions.GetRandomStringAsync(25).Result
            };

            var parameters = new List <SQLiteParameter>();
            var table      = new ArtistTable();
            var expected   = $"SELECT {ArtistTable.IdColumnName} FROM {table.TableName} WHERE {ArtistTable.NameColumnName} = @{ArtistTable.NameColumnName};";

            Assert.AreEqual(expected, table.GetIdFromNameSql(value, ref parameters));
            Assert.AreEqual(1, parameters.Count);
        }