public void ConstructorShould_CreateCategoryInfoService()
        {
            // Arrange
            var EfRepositoryStub = new Mock <IEfRepository <ContactInfo> >();
            var SaveContextStub  = new Mock <ISaveContext>();

            // Act
            var contactInfoService = new TelerikAcademy.FinalProject.Services.ContactInfoService(EfRepositoryStub.Object, SaveContextStub.Object);

            // Assert
            Assert.IsNotNull(contactInfoService);
        }
Exemplo n.º 2
0
        public void GetAll_Should_CallRepository_All()
        {
            // Arrange
            var EfRepositoryStub   = new Mock <IEfRepository <ContactInfo> >();
            var SaveContextStub    = new Mock <ISaveContext>();
            var contactInfoService = new TelerikAcademy.FinalProject.Services.ContactInfoService(EfRepositoryStub.Object, SaveContextStub.Object);

            // Act
            contactInfoService.GetAll();

            // Assert
            EfRepositoryStub.Verify(x => x.All, Times.Once);
        }
Exemplo n.º 3
0
        public void Update_Should_CallContextCommit()
        {
            // Arrange
            var         EfRepositoryStub   = new Mock <IEfRepository <ContactInfo> >();
            var         SaveContextMock    = new Mock <ISaveContext>();
            var         contactInfoService = new TelerikAcademy.FinalProject.Services.ContactInfoService(EfRepositoryStub.Object, SaveContextMock.Object);
            ContactInfo contact            = new ContactInfo();

            // Act
            contactInfoService.Update(contact);

            // Assert
            SaveContextMock.Verify(x => x.Commit(), Times.Once);
        }
Exemplo n.º 4
0
        public void GetById_ShouldReturnsNullWhenContactInfoIdIsNull()
        {
            //Arrange
            var  EfRepositoryStub = new Mock <IEfRepository <ContactInfo> >();
            var  SaveContextStub  = new Mock <ISaveContext>();
            Guid?contactInfoId    = Guid.NewGuid();


            var contactInfoService = new TelerikAcademy.FinalProject.Services.ContactInfoService(EfRepositoryStub.Object, SaveContextStub.Object);

            // Act
            ContactInfo contactInfoModel = contactInfoService.GetById(null);

            // Assert
            Assert.IsNull(contactInfoModel);
        }