Beispiel #1
0
        public void GetById_ShouldReturnNull_WhenWrongId()
        {
            // Arrange
            var context = GetContext(TestData.highTensileBoltsTypes);
            var repo    = new SqlHighTensileBoltsTypeRepo(context);

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

            // Assert
            Assert.Null(highTensileBoltsType);

            context.Database.EnsureDeleted();
            context.Dispose();
        }
Beispiel #2
0
        public void GetAll_ShouldReturnHighTensileBoltsTypes()
        {
            // Arrange
            var context = GetContext(TestData.highTensileBoltsTypes);
            var repo    = new SqlHighTensileBoltsTypeRepo(context);

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

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

            context.Database.EnsureDeleted();
            context.Dispose();
        }
Beispiel #3
0
        public void GetById_ShouldReturnHighTensileBoltsType()
        {
            // Arrange
            var context = GetContext(TestData.highTensileBoltsTypes);
            var repo    = new SqlHighTensileBoltsTypeRepo(context);

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

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

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

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