예제 #1
0
        public void MakeItemTest()
        {
            using (var dataAccess = Substitute.For <IDataAccess>())
            {
                using (var cursor = Substitute.For <ICursor>())
                {
                    cursor.GetInt(0).Returns(0);
                    cursor.GetString(1).Returns("string");

                    var map = new Dictionary <string, int>
                    {
                        [GenreTable.IdColumnName]   = 0,
                        [GenreTable.NameColumnName] = 1
                    };

                    using (var genreController = new GenreControllerTestClass(dataAccess))
                    {
                        var genre = genreController.MakeItem(cursor, map);
                        Assert.IsNotNull(genre);
                        Assert.IsInstanceOf <Genre>(genre);
                        Assert.AreEqual(0, genre.Id);
                        Assert.AreEqual("string", genre.Name);
                    }
                }
            }
        }
예제 #2
0
 public void ConstructorAndPropertiesTest()
 {
     using (var dataAccess = Substitute.For <IDataAccess>())
     {
         using (var genreController = new GenreControllerTestClass(dataAccess))
         {
             Assert.IsNotNull(genreController);
             Assert.IsInstanceOf <GenreController>(genreController);
             Assert.IsInstanceOf <AbstractController <Genre> >(genreController);
             Assert.IsNotNull(genreController.TestTable);
             Assert.IsInstanceOf <AbstractTable <Genre> >(genreController.TestTable);
         }
     }
 }