Ejemplo n.º 1
0
        public void CreateOwner_SpecifiedId_ThrowsNotSupportedException()
        {
            Mock <IOwnerRepository> ownerRepository = new Mock <IOwnerRepository>();
            OwnerService            ownerService    = new OwnerService(ownerRepository.Object);
            Owner owner = new Owner()
            {
                Id = 1
            };

            Action actual = () => ownerService.Create(owner);

            Assert.Throws <NotSupportedException>(actual);
        }
Ejemplo n.º 2
0
        public void CreateNewOwner_NullLastName_ThrowsInvalidDataException()
        {
            Mock <IOwnerRepository> ownerRepository = new Mock <IOwnerRepository>();
            OwnerService            ownerService    = new OwnerService(ownerRepository.Object);
            Owner owner = new Owner()
            {
                FirstName = "firstName", Address = "address", PhoneNumber = "phoneNumber", Email = "email"
            };

            Action actual = () => ownerService.Create(owner);

            Assert.Throws <InvalidDataException>(actual);
        }
Ejemplo n.º 3
0
        public void Create_MethodIsRun_RunsOkVoid()  /// Tests the Edit method is run
        {
            //arrange
            Owner owner = new Owner();

            mockOwnerRepository.Setup(repo => repo.Edit(It.IsAny <Owner>()));

            //act
            OwnerEditViewModel ownerVm = new OwnerEditViewModel();

            ownerVm.Owner = new OwnerViewModel {
                OwnerId = 1, EmailAddress = "", PhoneNumber = "", Title = "A", FullName = "RG", PropertiesOwned = 1
            };

            service.Create(ownerVm);

            //assert

            mockOwnerRepository.VerifyAll();
        }