public async Task ShouldCheckOutPersons() { var addressRepository = Substitute.For <IRepository <Address, Guid> >(); var addressDataProvider = Substitute.For <IAddressDataProvider>(); var addressFactory = new AddressFactory(); var addressEntity = addressFactory.Create(new AddressFactoryInput() { City = "test", Street = "test", HomeNumber = "test", StreetNumber = "test", Id = Guid.NewGuid() }); addressEntity.CheckInPersons(6); addressRepository.Get(addressEntity.Id).Returns(addressEntity); AddressController addressController = new AddressController(addressRepository, addressDataProvider, addressFactory, Substitute.For <IMeterReadDataProvider>()); await addressController.CheckOutPerson(new CheckOut() { AddressId = addressEntity.Id, Persons = 5 }); await addressRepository.Received(1).Get(addressEntity.Id); Assert.Equal(1, addressEntity.CheckedInPersons); }