Example #1
0
        public void GetById_ShouldReturnNull_WhenWrongId()
        {
            // Arrange
            var context = GetContext(TestData.gasGroups);
            var repo    = new SqlGasGroupRepo(context);

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

            // Assert
            Assert.Null(gasGroup);

            context.Database.EnsureDeleted();
            context.Dispose();
        }
Example #2
0
        public void GetById_ShouldReturnGasGroup()
        {
            // Arrange
            var context = GetContext(TestData.gasGroups);
            var repo    = new SqlGasGroupRepo(context);

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

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

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

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