public void GetAllByMarkIdAndDocType_ShouldReturnEmptyArray_WhenWrongMarkId() { // Arrange var context = GetContext(TestData.docs); var repo = new SqlDocRepo(context); var docTypeId = _rnd.Next(1, TestData.docTypes.Count()); // Act var docs = repo.GetAllByMarkIdAndDocType(999, docTypeId); // Assert Assert.Empty(docs); context.Database.EnsureDeleted(); context.Dispose(); }
public void GetAllByMarkIdAndDocType_ShouldReturnDocs() { // Arrange var context = GetContext(TestData.docs); var repo = new SqlDocRepo(context); var markId = _rnd.Next(1, _maxMarkId); var docTypeId = _rnd.Next(1, TestData.docTypes.Count()); // Act var docs = repo.GetAllByMarkIdAndDocType(markId, docTypeId); // Assert Assert.Equal(TestData.docs.Where( v => v.Mark.Id == markId && v.Type.Id == docTypeId), docs); context.Database.EnsureDeleted(); context.Dispose(); }