public void InterceptVirtualGenericMethod() { NopInterceptor ni = new NopInterceptor(); AdvisedSupport advised = new AdvisedSupport(); advised.Target = new AnotherTestObject(); advised.AddAdvice(ni); object proxy = CreateProxy(advised); //DynamicProxyManager.SaveAssembly(); Assert.IsTrue(proxy is AnotherTestObject); AnotherTestObject proxiedClass = proxy as AnotherTestObject; Assert.AreEqual(typeof(int), proxiedClass.GenericMethod <int>()); Assert.AreEqual(1, ni.Count); }
// SPRNET-1429 public void InterceptVirtualGenericMethodWithGenericParameter() { NopInterceptor ni = new NopInterceptor(); AdvisedSupport advised = new AdvisedSupport(); advised.Target = new AnotherTestObject(); advised.AddAdvice(ni); object proxy = CreateProxy(advised); //DynamicProxyManager.SaveAssembly(); Assert.IsTrue(proxy is AnotherTestObject); AnotherTestObject proxiedClass = proxy as AnotherTestObject; Assert.AreEqual("Hello", proxiedClass.AnotherGenericMethod <string>("Hello")); Assert.AreEqual(1, ni.Count); }
public async Task WhenUsingAnotherTestObject_ThenYouCanSearch_Test() { var logger = _factory.CreateLogger <GenericRepository <AnotherTestObject> >(); var repo = new GenericRepository <AnotherTestObject>(_client, logger, _cosmos); var item = new AnotherTestObject() { Name = "CoolThing", IsDeleted = false, Quantity = 100 }; var itemId = await repo.Upsert(item); var searchResults = await repo.Get(x => x.Quantity == 100, new SearchModel()); searchResults.Results.Should().Contain(x => x.Id == itemId); //Cleanup //await _client.DeleteDocumentCollectionAsync(UriFactory.CreateDocumentCollectionUri(_cosmos.Value.DefaultDatabaseName, "AnotherTestObject")); }