public void SetRenewsLease() { // Fixture setup var leaseMock = new Mock <ILease>(); var dummyCache = new Mock <IObjectCache>().Object; var sut = new LeasedObjectCache(leaseMock.Object, dummyCache); // Exercise system var anonymousType = typeof(object); var anonymousInstance = new ConstructorInstance(anonymousType); var anonymousValue = new object(); sut.Set(anonymousType, anonymousInstance, anonymousValue); // Verify outcome leaseMock.Verify(l => l.Renew()); // Teardown }
public void SetSetsOnDecoratedCache() { // Fixture setup var anonymousType = typeof(object); var anonymousInstance = new ConstructorInstance(anonymousType); var anonymousValue = new object(); var dummyLease = new Mock <ILease>().Object; var cacheMock = new Mock <IObjectCache>(); var sut = new LeasedObjectCache(dummyLease, cacheMock.Object); // Exercise system sut.Set(anonymousType, anonymousInstance, anonymousValue); // Verify outcome cacheMock.Verify(c => c.Set(anonymousType, anonymousInstance, anonymousValue)); // Teardown }
public void SetRenewsLease() { // Fixture setup var leaseMock = new Mock<ILease>(); var dummyCache = new Mock<IObjectCache>().Object; var sut = new LeasedObjectCache(leaseMock.Object, dummyCache); // Exercise system var anonymousType = typeof(object); var anonymousInstance = new ConstructorInstance(anonymousType); var anonymousValue = new object(); sut.Set(anonymousType, anonymousInstance, anonymousValue); // Verify outcome leaseMock.Verify(l => l.Renew()); // Teardown }
public void SetSetsOnDecoratedCache() { // Fixture setup var anonymousType = typeof(object); var anonymousInstance = new ConstructorInstance(anonymousType); var anonymousValue = new object(); var dummyLease = new Mock<ILease>().Object; var cacheMock = new Mock<IObjectCache>(); var sut = new LeasedObjectCache(dummyLease, cacheMock.Object); // Exercise system sut.Set(anonymousType, anonymousInstance, anonymousValue); // Verify outcome cacheMock.Verify(c => c.Set(anonymousType, anonymousInstance, anonymousValue)); // Teardown }