Esempio n. 1
0
        public void GetAll_ShouldReturnsteel()
        {
            // Act
            var context = GetContext(TestData.steel);
            var repo    = new SqlSteelRepo(context);

            var steel = repo.GetAll();

            // Assert
            Assert.Equal(TestData.steel, steel);

            context.Database.EnsureDeleted();
            context.Dispose();
        }
Esempio n. 2
0
        public void GetById_ShouldReturnNull_WhenWrongId()
        {
            // Arrange
            var context = GetContext(TestData.steel);
            var repo    = new SqlSteelRepo(context);

            // Act
            var steel = repo.GetById(999);

            // Assert
            Assert.Null(steel);

            context.Database.EnsureDeleted();
            context.Dispose();
        }
Esempio n. 3
0
        public void GetById_ShouldReturnsteel()
        {
            // Arrange
            var context = GetContext(TestData.steel);
            var repo    = new SqlSteelRepo(context);

            int id = _rnd.Next(1, TestData.steel.Count());

            // Act
            var steel = repo.GetById(id);

            // Assert
            Assert.Equal(TestData.steel.SingleOrDefault(v => v.Id == id),
                         steel);

            context.Database.EnsureDeleted();
            context.Dispose();
        }