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(); }
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(); }