public void AddCopyDetailsTest() { IDataFiller constantDataFiller = new ConstantDataFiller(); IDataRepository dataRepository = new DataRepositoryForTest(constantDataFiller); IDataService dataService = new DataService(dataRepository); CopyDetails copyDetails = new CopyDetails(dataRepository.GetBook(3), 15.60m, 2.60m, 2, "Sample book invoice"); int copyDetailsNumber = dataService.GetAllCopyDetails().ToImmutableHashSet().Count; dataService.AddCopyDetails(copyDetails); Assert.Equal(copyDetailsNumber + 1, dataService.GetAllCopyDetails().ToImmutableHashSet().Count); Assert.Equal(copyDetails, dataService.GetAllCopyDetails().Last()); }
public void DeleteCopyDetailsTest() { IDataFiller constantDataFiller = new ConstantDataFiller(); IDataRepository dataRepository = new DataRepositoryForTest(constantDataFiller); IDataService dataService = new DataService(dataRepository); CopyDetails copyDetails = new CopyDetails(dataRepository.GetBook(2), 15.6m, 2.30m, 1, "Sample invoice"); dataService.AddCopyDetails(copyDetails); int originalCount = dataService.GetAllCopyDetails().ToImmutableHashSet().Count; dataService.DeleteCopyDetails(copyDetails); Assert.Equal(originalCount - 1, dataService.GetAllCopyDetails().ToImmutableHashSet().Count); Assert.DoesNotContain(copyDetails, dataService.GetAllCopyDetails()); }