Пример #1
0
        public void GetById_ShouldReturnNull_WhenWrongId()
        {
            // Arrange
            var context = GetContext(TestData.operatingAreas);
            var repo    = new SqlOperatingAreaRepo(context);

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

            // Assert
            Assert.Null(operatingArea);

            context.Database.EnsureDeleted();
            context.Dispose();
        }
Пример #2
0
        public void GetAll_ShouldReturnOperatingAreas()
        {
            // Arrange
            var context = GetContext(TestData.operatingAreas);
            var repo    = new SqlOperatingAreaRepo(context);

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

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

            context.Database.EnsureDeleted();
            context.Dispose();
        }
Пример #3
0
        public void GetById_ShouldReturnOperatingArea()
        {
            // Arrange
            var context = GetContext(TestData.operatingAreas);
            var repo    = new SqlOperatingAreaRepo(context);

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

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

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

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