public async Task Delete_RemovesCollectableFromDatabase()
        {
            //Arrange
            Guid id           = new Guid("355e785b-dd47-4fb7-b112-1fb34d189569");
            Guid collectionId = new Guid("46df9402-62e1-4ff6-9cb0-0955957ec789");
            CollectionCollectable collectable = await _unitOfWork.CollectionCollectables
                                                .GetSingle(new CollectionCollectableByCollectionId(collectionId) && new CollectionCollectableById(id));

            //Act
            _unitOfWork.CollectionCollectables.Delete(collectable);
            await _unitOfWork.Save();

            //Assert
            Assert.Equal(5, (await _unitOfWork.CollectionCollectables.GetAll()).Count());
            Assert.Null(await _unitOfWork.CollectionCollectables
                        .GetSingle(new CollectionCollectableByCollectionId(collectionId) && new CollectionCollectableById(id)));
        }
        public async Task RemoveCollectionCollectable_RemovesCollectionCollectableFromDatabase()
        {
            //Arrange
            Guid id           = new Guid("355e785b-dd47-4fb7-b112-1fb34d189569");
            Guid collectionId = new Guid("46df9402-62e1-4ff6-9cb0-0955957ec789");
            CollectionCollectable collectable = await _collectionCollectableService
                                                .FindCollectionCollectableById(collectionId, id);

            //Act
            _collectionCollectableService.RemoveCollectionCollectable(collectable);
            await _unitOfWork.Save();

            //Assert
            Assert.Single(await _collectionCollectableService
                          .FindCollectionCollectables(collectionId, resourceParameters));
            Assert.Null(await _collectionCollectableService
                        .FindCollectionCollectableById(collectionId, id));
        }
        public async Task UpdateCollectionCollectable_UpdatesExistingCollectionCollectable()
        {
            //Arrange
            Guid id           = new Guid("355e785b-dd47-4fb7-b112-1fb34d189569");
            Guid collectionId = new Guid("46df9402-62e1-4ff6-9cb0-0955957ec789");

            CollectionCollectable updatedCollectable = await _collectionCollectableService
                                                       .FindCollectionCollectableById(collectionId, id);

            var collectable = await _collectionCollectableService
                              .FindCollectableById(new Guid("db14f24e-aceb-4315-bfcf-6ace1f9b3613"));

            updatedCollectable.Collectable = collectable;

            //Act
            _collectionCollectableService.UpdateCollectionCollectable(updatedCollectable);
            await _unitOfWork.Save();

            //Assert
            Assert.Equal(2, (await _collectionCollectableService
                             .FindCollectionCollectables(collectionId, resourceParameters)).Count());
            Assert.Equal("Japan", (await _collectionCollectableService
                                   .FindCollectionCollectableById(collectionId, id)).Collectable.Country.Name);
        }
        public async Task CreateCollectionCollectable_CreatesNewCollectionCollectable()
        {
            //Arrange
            Guid id           = new Guid("60e55387-ee18-4e5c-866f-7ca1d2d09c0f");
            Guid collectionId = new Guid("46df9402-62e1-4ff6-9cb0-0955957ec789");
            CollectionCollectable newCollectable = new CollectionCollectable
            {
                Id            = id,
                CollectionId  = collectionId,
                CollectableId = new Guid("dc94e4a0-8ad1-4eec-ad9d-e4c6cf147f48"),
                ConditionId   = new Guid("371da3ae-d2e0-4ee7-abf3-3a7574ae669a")
            };

            //Act
            await _collectionCollectableService.CreateCollectionCollectable(newCollectable);

            await _unitOfWork.Save();

            //Assert
            Assert.Equal(3, (await _collectionCollectableService
                             .FindCollectionCollectables(collectionId, resourceParameters)).Count());
            Assert.Equal("France", (await _collectionCollectableService
                                    .FindCollectionCollectableById(collectionId, id)).Collectable.Country.Name);
        }
        public async Task Add_AddsNewCollectionCollectable()
        {
            //Arrange
            Guid id           = new Guid("60e55387-ee18-4e5c-866f-7ca1d2d09c0f");
            Guid collectionId = new Guid("46df9402-62e1-4ff6-9cb0-0955957ec789");
            CollectionCollectable newCollectable = new CollectionCollectable
            {
                Id            = id,
                CollectionId  = collectionId,
                CollectableId = new Guid("dc94e4a0-8ad1-4eec-ad9d-e4c6cf147f48"),
                ConditionId   = new Guid("371da3ae-d2e0-4ee7-abf3-3a7574ae669a")
            };

            //Act
            await _unitOfWork.CollectionCollectables.Add(newCollectable);

            await _unitOfWork.Save();

            //Assert
            Assert.Equal(7, (await _unitOfWork.CollectionCollectables.GetAll()).Count());
            Assert.Equal("France", (await _unitOfWork.CollectionCollectables
                                    .GetSingle(new CollectionCollectableByCollectionId(collectionId) && new CollectionCollectableById(id)))
                         .Collectable.Country.Name);
        }
 public void RemoveCollectionCollectable(CollectionCollectable collectable)
 {
     _unitOfWork.CollectionCollectables.Delete(collectable);
 }
 public void UpdateCollectionCollectable(CollectionCollectable collectable)
 {
 }
 public async Task CreateCollectionCollectable(CollectionCollectable collectable)
 {
     await _unitOfWork.CollectionCollectables.Add(collectable);
 }
 public CollectionCollectableTestBuilder()
 {
     collectionCollectable = new CollectionCollectable();
 }