Ejemplo n.º 1
0
        public void GetById_ShouldReturnNull_WhenWrongId()
        {
            // Arrange
            var context = GetContext(TestData.envAggressiveness);
            var repo    = new SqlEnvAggressivenessRepo(context);

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

            // Assert
            Assert.Null(envAggressiveness);

            context.Database.EnsureDeleted();
            context.Dispose();
        }
Ejemplo n.º 2
0
        public void GetAll_ShouldReturnEnvAggressiveness()
        {
            // Arrange
            var context = GetContext(TestData.envAggressiveness);
            var repo    = new SqlEnvAggressivenessRepo(context);

            // Act
            var envAggressiveness = repo.GetAll();

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

            context.Database.EnsureDeleted();
            context.Dispose();
        }
Ejemplo n.º 3
0
        public void GetById_ShouldReturnEnvAggressiveness()
        {
            // Arrange
            var context = GetContext(TestData.envAggressiveness);
            var repo    = new SqlEnvAggressivenessRepo(context);

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

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

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

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