public void WhenGettingEntity_ThenReturnsCorrectEntity() { // Arrange var repositoryMock = new Mock<IPartTypeRepository>(); PartType newEntity = DefaultModelHelper.DummyPopulatedPartType(); repositoryMock.Setup(repo => repo.GetById(It.IsAny<int>())).Returns(newEntity); // Act var services = new PartTypeService(repositoryMock.Object, new Mock<IUnitOfWork>().Object); PartType returnedEntity = services.GetById(1); // Assert Assert.NotNull(returnedEntity); Assert.Equal("Title", returnedEntity.Title); }
private void InitializeServices() { this.domainService = new DomainService(this.domainRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.clientAssetConfigService = new ClientAssetConfigService( this.clientAssetConfigRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.clientAssetService = new ClientAssetService( this.clientAssetRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.clientAssetTypeService = new ClientAssetTypeService( this.clientAssetTypeRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.pageService = new PageService(this.pageRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.pageTemplateService = new PageTemplateService( this.pageTemplateRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.pageTemplateZoneMapService = new PageTemplateZoneMapService( this.pageTemplateZoneMapRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.pageZoneService = new PageZoneService( this.pageZoneRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.partService = new PartService(this.partRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.partTypeService = new PartTypeService( this.partTypeRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.seoDecoratorService = new SeoDecoratorService( this.seoDecoratorRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.userService = new UserService(this.userRepositoryMock.Object, new Mock<IUnitOfWork>().Object); this.partContainerService = new PartContainerService( this.partContainerRepositoryMock.Object, new Mock<IUnitOfWork>().Object); }