示例#1
0
        public void WithContainedComponent_ComponentWithSameIdentityAdded_ShouldThrowArgumentException()
        {
            //Arrange
            var commonId        = Guid.NewGuid();
            var firstComponent  = CreateComponent(1).WithId(commonId);
            var secondComponent = CreateComponent(2).WithId(commonId);

            DefaultComponent.WithContainedComponent(firstComponent);

            Assert.That(() => DefaultComponent.WithContainedComponent(secondComponent),
                        Throws.InstanceOf <DuplicateElementException>());
        }
示例#2
0
 public void WithContainedComponent_SameReferenceAsParent_ShouldThrowArgumentException()
 {
     Assert.That(() => DefaultComponent.WithContainedComponent(DefaultComponent),
                 Throws.InstanceOf <ArgumentException>());
 }
示例#3
0
 public void WithContainedComponent_NullComponent_ShouldThrowArgumentNullException()
 {
     Assert.That(() => DefaultComponent.WithContainedComponent(null), Throws.InstanceOf <ArgumentNullException>());
 }