示例#1
0
        public void RemoveProfileThrowsExceptionWithEmptyIdTest()
        {
            var cache  = Substitute.For <IMemoryCache>();
            var config = Substitute.For <ICacheConfig>();

            var sut = new ProfileCache(cache, config);

            Action action = () => sut.RemoveProfile(Guid.Empty);

            action.Should().Throw <ArgumentException>();
        }
示例#2
0
        public void RemoveProfileDeletesProfileFromCacheTest()
        {
            var expected = Model.Create <Profile>();
            var cacheKey = "Profile|" + expected.Id;

            var cache  = Substitute.For <IMemoryCache>();
            var config = Substitute.For <ICacheConfig>();

            var sut = new ProfileCache(cache, config);

            sut.RemoveProfile(expected.Id);

            cache.Received().Remove(cacheKey);
        }