public void CreateLocation_BlankLegalName_ThrowsArgumentException() { var locationRepository = new Mock<ILocationRepository> (); var locationFactory = new LocationFactory ( locationRepository.Object ); var agency = new Mock<Agency> (); locationFactory.CreateLocation ( agency.Object, new LocationProfileBuilder().WithLocationName(new LocationNameBuilder().WithName(" "))); }
public void CreateLocation_GivenValidArguments_CreatesALocation() { using (var serviceLocatorFixture = new ServiceLocatorFixture()) { // Setup SetupServiceLocatorFixture(serviceLocatorFixture); var locationRepository = new Mock<ILocationRepository>(); var locationFactory = new LocationFactory(locationRepository.Object); var agency = new Mock<Agency>(); var location = locationFactory.CreateLocation( agency.Object, new LocationProfileBuilder().WithLocationName(new LocationNameBuilder().WithName(LegalName))); Assert.IsNotNull(location); } }
public void CreateLocation_GivenValidArguments_LocationIsEditable() { using (var serviceLocatorFixture = new ServiceLocatorFixture()) { // Setup SetupServiceLocatorFixture(serviceLocatorFixture); var locationRepository = new Mock<ILocationRepository>(); var locationFactory = new LocationFactory(locationRepository.Object); var agency = new Mock<Agency>(); var location = locationFactory.CreateLocation( agency.Object, new LocationProfileBuilder().WithLocationName(new LocationNameBuilder().WithName(LegalName))); location.ReviseLocationProfile( new LocationProfileBuilder().WithLocationName(new LocationNameBuilder().WithName("Some Name").Build()).Build()); } }
public void CreateLocation_NullAgency_ThrowsArgumentException() { using (var serviceLocatorFixture = new ServiceLocatorFixture()) { // Setup SetupServiceLocatorFixture(serviceLocatorFixture); var locationRepository = new Mock<ILocationRepository>(); var locationFactory = new LocationFactory(locationRepository.Object); locationFactory.CreateLocation(null, new LocationProfileBuilder().WithLocationName(new LocationNameBuilder().WithName(LegalName))); } }
public void CreateLocation_GivenValidArguments_LocationIsMadePersistent() { using (var serviceLocatorFixture = new ServiceLocatorFixture()) { // Setup SetupServiceLocatorFixture(serviceLocatorFixture); var isPersistent = false; var locationRepository = new Mock<ILocationRepository>(); locationRepository.Setup(l => l.MakePersistent(It.IsAny<Location>())).Callback(() => isPersistent = true); var locationFactory = new LocationFactory(locationRepository.Object); var agency = new Mock<Agency>(); locationFactory.CreateLocation( agency.Object, new LocationProfileBuilder().WithLocationName(new LocationNameBuilder().WithName(LegalName))); Assert.IsTrue(isPersistent); } }
public void DestroyLocation_GivenANullLocation_ThrowsArgumentException() { var locationRepository = new Mock<ILocationRepository> (); var locationFactory = new LocationFactory ( locationRepository.Object ); locationFactory.DestroyLocation ( null ); }
public void DestroyLocation_GivenALocation_LocationIsTransient() { var isTransient = false; var locationRepository = new Mock<ILocationRepository> (); locationRepository .Setup ( l => l.MakeTransient ( It.IsAny<Location> () ) ) .Callback ( () => isTransient = true ); var locationFactory = new LocationFactory ( locationRepository.Object ); var location = new Mock<Location> (); locationFactory.DestroyLocation ( location.Object ); Assert.IsTrue ( isTransient ); }
public void CreateLocation_NullLegalName_ThrowsArgumentException() { using (var serviceLocatorFixture = new ServiceLocatorFixture()) { // Setup SetupServiceLocatorFixture(serviceLocatorFixture); var locationRepository = new Mock<ILocationRepository>(); var locationFactory = new LocationFactory(locationRepository.Object); var agency = new Mock<Agency>(); locationFactory.CreateLocation(agency.Object, null); } }