public void RemoveStrategies() { //Arrange IGarbageDisposalStrategy ds = new BurnableGarbageDisposalStrategy(); Type disType = typeof(DisposableAttribute); IDictionary <Type, IGarbageDisposalStrategy> strategies = new Dictionary <Type, IGarbageDisposalStrategy>(); IStrategyHolder sut = new StrategyHolder(strategies); //Act bool reult2 = sut.AddStrategy(disType, ds); //Assert Assert.IsTrue(sut.RemoveStrategy(disType)); }
public void TestPropertyForReadOnlyCollection() { //Arrange IGarbageDisposalStrategy ds = new BurnableGarbageDisposalStrategy(); Type disType = typeof(DisposableAttribute); IDictionary <Type, IGarbageDisposalStrategy> strategies = new Dictionary <Type, IGarbageDisposalStrategy>(); IStrategyHolder sut = new StrategyHolder(strategies); //Act Type type = sut.GetDisposalStrategies.GetType(); //Assert var test = type.GetInterfaces(); Assert.IsTrue(type.GetInterfaces().Contains(typeof(System.Collections.Generic.IReadOnlyCollection <>))); }
public void AddSameStrategies() { //Arrange IGarbageDisposalStrategy ds = new BurnableGarbageDisposalStrategy(); Type disType = typeof(DisposableAttribute); IDictionary <Type, IGarbageDisposalStrategy> strategies = new Dictionary <Type, IGarbageDisposalStrategy>(); IStrategyHolder sut = new StrategyHolder(strategies); //Act bool reult = sut.AddStrategy(disType, ds); bool reult1 = sut.AddStrategy(disType, ds); bool reult2 = sut.AddStrategy(disType, ds); //Assert Assert.AreEqual(1, sut.GetDisposalStrategies.Count); }
public void AddDifferentStrategiesAndCheckCount() { //Arrange IGarbageDisposalStrategy ds = new BurnableGarbageDisposalStrategy(); Type disType = typeof(StorableStrategyAttribute); Type disType1 = typeof(BurnableStrategyAttribute); Type disType2 = typeof(RecyclableStrategyAttribute); IDictionary <Type, IGarbageDisposalStrategy> strategies = new Dictionary <Type, IGarbageDisposalStrategy>(); IStrategyHolder sut = new StrategyHolder(strategies); //Act bool reult = sut.AddStrategy(disType, ds); bool reult1 = sut.AddStrategy(disType1, ds); bool reult2 = sut.AddStrategy(disType2, ds); //Assert Assert.AreEqual(3, sut.GetDisposalStrategies.Count); }