Exemplo n.º 1
0
        public void GetById_ShouldReturnNull_WhenWrongId()
        {
            // Arrange
            var context = GetContext(TestData.constructionTypes);
            var repo    = new SqlConstructionTypeRepo(context);

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

            // Assert
            Assert.Null(constructionType);

            context.Database.EnsureDeleted();
            context.Dispose();
        }
Exemplo n.º 2
0
        public void GetAll_ShouldReturnConstructionTypes()
        {
            // Arrange
            var context = GetContext(TestData.constructionTypes);
            var repo    = new SqlConstructionTypeRepo(context);

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

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

            context.Database.EnsureDeleted();
            context.Dispose();
        }
Exemplo n.º 3
0
        public void GetById_ShouldReturnConstructionType()
        {
            // Arrange
            var context = GetContext(TestData.constructionTypes);
            var repo    = new SqlConstructionTypeRepo(context);

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

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

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

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