public void CanGetEqualsWithOneNullContentLink() { var contentUsage1 = new ContentUsage() { ContentLink = null }; var contentUsage2 = new ContentUsage() { ContentLink = new ContentReference(1) }; var result = _contentUsageComparer.Equals(contentUsage1, contentUsage2); Assert.IsFalse(result); }
public void TestInitialize() { // IContentEvents _contentEventsMock = new Mock<IContentEvents>(); // IContentTypeRepository var contentTypeRepositoryMock = new Mock<IContentTypeRepository>(); contentTypeRepositoryMock.Setup(x => x.Load(1)).Returns(new ContentType()); // IContentModelUsage var contentModelUsageMock = new Mock<IContentModelUsage>(); var usages = new List<ContentUsage>(); var contentUsage = new ContentUsage(); var contentReference = new ContentReference(); contentReference.ID = 1; contentUsage.ContentLink = contentReference; contentModelUsageMock.Setup(x => x.ListContentOfContentType(It.IsAny<ContentType>())).Returns(new List<ContentUsage>() { contentUsage }); // IContentRepository var contentRepositoryMock = new Mock<IContentRepository>(); contentRepositoryMock.Setup(x => x.GetItems(It.IsAny<IEnumerable<ContentReference>>(), LanguageSelector.MasterLanguage())).Returns(new List<IContent>()); // LocalizationService var localizationService = new MemoryLocalizationService(); localizationService.AddString(new CultureInfo("en"), "/RestrictMultiple/max", " Max Error"); localizationService.AddString(new CultureInfo("en"), "/RestrictMultiple/culturemax", "CultureMax Error"); // IServiceLocator var serviceLocatorMock = new Mock<IServiceLocator>(); serviceLocatorMock.Setup(x => x.GetInstance<IContentEvents>()).Returns(_contentEventsMock.Object); serviceLocatorMock.Setup(x => x.GetInstance<IContentTypeRepository>()).Returns(contentTypeRepositoryMock.Object); serviceLocatorMock.Setup(x => x.GetInstance<IContentRepository>()).Returns(contentRepositoryMock.Object); serviceLocatorMock.Setup(x => x.GetInstance<IContentModelUsage>()).Returns(contentModelUsageMock.Object); serviceLocatorMock.Setup(x => x.GetInstance<LocalizationService>()).Returns(localizationService); ServiceLocator.SetLocator(serviceLocatorMock.Object); }
public void CanGetEqualsWithNullContentLinks() { var contentUsage1 = new ContentUsage() { ContentLink = null }; var contentUsage2 = new ContentUsage() { ContentLink = null }; var result = _contentUsageComparer.Equals(contentUsage1, contentUsage2); Assert.IsTrue(result); }