コード例 #1
0
        public void GetProducts_ShouldReturnAllProducts()
        {
            var context = new TestTemperatureContext();
            context.Table.Add(new TemperatureModel { Id = 1, Temperature = "10", DateTime= DateTime.Now});
            context.Table.Add(new TemperatureModel { Id = 2, Temperature = "15", DateTime = DateTime.Now });
            context.Table.Add(new TemperatureModel { Id = 3, Temperature = "20", DateTime = DateTime.Now });

            var controller = new TemperatureModelsController(context);
            var result = controller.GetTable() as TestTemperatureModelDbSet;

            Assert.IsNotNull(result);
            Assert.AreEqual(3, result.Local.Count);
        }