Пример #1
0
        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("   ")));
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
        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());
            }
        }
Пример #4
0
        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)));
            }
        }
Пример #5
0
        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);
            }
        }
Пример #6
0
        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);
            }
        }