示例#1
0
        public void TestMissingImageUrl()
        {
            var mUnitOfWork = new Mock <ISearchALotUnitOfWork>();

            mUnitOfWork.Setup(f => f.Persons.AddPerson(It.IsAny <Person>()));

            var personManagementService = new PersonManagementService(mUnitOfWork.Object);

            var personDto = new PersonDTO()
            {
                FirstName = "Myname", LastName = "Friend", City = "Cityssss", State = "UT", StreetAddress = "MyAddress", ZipCode = "84444"
            };
            var response = personManagementService.AddPerson(personDto);

            Assert.IsFalse(response.Success);
        }
        public void SetUp()
        {
            ServiceLocatorInitializer.Init();

            _personRepository =
                MockRepository.GenerateMock <IPersonRepository>();
            _personRepository.Stub(r => r.DbContext)
            .Return(MockRepository.GenerateMock <IDbContext>());

            _supportTeamRepository = MockRepository.GenerateMock <ISupportTeamRepository>();
            _supportTeamRepository.Stub(r => r.DbContext)
            .Return(MockRepository.GenerateMock <IDbContext>());

            _orgManagementService = MockRepository.GenerateMock <IOrgManagementService>();

            _roleManagementService   = MockRepository.GenerateMock <IRoleManagementService>();
            _personManagementService =
                new PersonManagementService(_personRepository, _orgManagementService, _supportTeamRepository,
                                            _roleManagementService);
        }
示例#3
0
        public void TestMissingLastName()
        {
            //setup
            var mUnitOfWork = new Mock <ISearchALotUnitOfWork>();

            mUnitOfWork.Setup(f => f.Persons.AddPerson(It.IsAny <Person>()));

            var personManagementService = new PersonManagementService(mUnitOfWork.Object);
            var personDto = new PersonDTO()
            {
                FirstName = "MyName"
            };


            //action
            var response = personManagementService.AddPerson(personDto);

            //assert
            Assert.IsFalse(response.Success);
        }
示例#4
0
        public void TestAddSuccessful()
        {
            //setup
            var mUnitOfWork = new Mock <ISearchALotUnitOfWork>();

            mUnitOfWork.Setup(f => f.Persons.AddPerson(It.IsAny <Person>()));

            var personManagementService = new PersonManagementService(mUnitOfWork.Object);
            var personDto = new PersonDTO()
            {
                FirstName = "Myname", LastName = "Friend", City = "Cityssss", ImageUrl = "image.gif", State = "UT", StreetAddress = "MyAddress", ZipCode = "84444"
            };


            //action
            var response = personManagementService.AddPerson(personDto);

            //assert
            Assert.IsTrue(response.Success);
        }
示例#5
0
        public void TestMissingAddress()
        {
            var mUnitOfWork = new Mock <ISearchALotUnitOfWork>();

            mUnitOfWork.Setup(f => f.Persons.AddPerson(It.IsAny <Person>()));

            var personManagementService = new PersonManagementService(mUnitOfWork.Object);

            var personDtoMissingCity = new PersonDTO()
            {
                FirstName = "MyName", LastName = "LastName", State = "UT", StreetAddress = "45", ZipCode = "45345", ImageUrl = "image.gif"
            };
            var response = personManagementService.AddPerson(personDtoMissingCity);

            Assert.IsFalse(response.Success);

            var personDtoMissingState = new PersonDTO()
            {
                FirstName = "MyName", LastName = "LastName", StreetAddress = "45", City = "Cityzz", ZipCode = "45345", ImageUrl = "image.gif"
            };

            response = personManagementService.AddPerson(personDtoMissingState);
            Assert.IsFalse(response.Success);

            var personDtoMissingStreetAddress = new PersonDTO()
            {
                FirstName = "MyName", LastName = "LastName", State = "UT", City = "Cityzz", ZipCode = "45345", ImageUrl = "image.gif"
            };

            response = personManagementService.AddPerson(personDtoMissingStreetAddress);
            Assert.IsFalse(response.Success);

            var personDtoMissingZip = new PersonDTO()
            {
                FirstName = "Myname", LastName = "Friend", City = "Cityssss", ImageUrl = "image.gif", State = "UT", StreetAddress = "MyAddress"
            };

            response = personManagementService.AddPerson(personDtoMissingZip);
            Assert.IsFalse(response.Success);
        }