Ejemplo n.º 1
0
        public void GetAllByTypeId_ShouldReturnEmptyArray_WhenWrongMarkId()
        {
            var context = GetContext(TestData.constructionSubtypes);
            var repo    = new SqlConstructionSubtypeRepo(context);

            // Act
            var constructionSubtypes = repo.GetAllByTypeId(999);

            // Assert
            Assert.Empty(constructionSubtypes);

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

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

            // Assert
            Assert.Null(constructionSubtype);

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

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

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

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

            context.Database.EnsureDeleted();
            context.Dispose();
        }
Ejemplo n.º 4
0
        public void GetAllByTypeId_ShouldReturnConstructionSubtypes()
        {
            // Arrange
            var context = GetContext(TestData.constructionSubtypes);
            var repo    = new SqlConstructionSubtypeRepo(context);

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

            // Act
            var constructionSubtypes = repo.GetAllByTypeId(typeId);

            // Assert
            Assert.Equal(TestData.constructionSubtypes.Where(
                             v => v.Type.Id == typeId), constructionSubtypes);

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