public void RemoveCachedData_ShouldNotCallRemoveOfOrganizationServiceCache_WhenContextIsOfWrongType() { var contextMock = new Mock<ICrmServiceContext>(); m_context = contextMock.Object; m_context.RemoveCachedData(TestName, TestGuid); m_serviceCacheMock.Verify(x => x.Remove(It.IsAny<string>(), It.IsAny<Guid?>()), Times.Never); }
public void RemoveCachedData_ShouldNotCallRemoveOfOrganizationServiceCache_WhenInternalServiceIsNotOfCachedOrganizationServiceType() { var contextMock = new Mock<ICrmServiceContext>(); contextMock.As<IOrganizationServiceContainer>().SetupGet(x => x.Service).Returns((IOrganizationService)null); m_context = contextMock.Object; m_context.RemoveCachedData(TestName, TestGuid); m_serviceCacheMock.Verify(x => x.Remove(It.IsAny<string>(), It.IsAny<Guid?>()), Times.Never); }
public void RemoveCachedData_ShouldCallRemoveOfOrganizationServiceCache_WhenOrganizationServiceCacheIsConfigured() { var contextMock = new Mock<ICrmServiceContext>(); contextMock.As<IOrganizationServiceContainer>().SetupGet(x => x.Service) .Returns(new CachedOrganizationService("Xrm", m_serviceCacheMock.Object)); m_context = contextMock.Object; m_context.RemoveCachedData(TestName, TestGuid); m_serviceCacheMock.Verify(x => x.Remove(TestName, TestGuid), Times.Once); }