示例#1
0
        public void CopyItemThrowsIfDestinationIsNull(
            FakeDataProvider sut,
            ItemDefinition source)
        {
            Action action = () => sut.CopyItem(source, null, null, ID.Null, null);

            action.ShouldThrow <ArgumentNullException>().Which.ParamName.Should().Be("destination");
        }
示例#2
0
        public void CopyItemThrowsIfCopyIdIsNull(
            FakeDataProvider sut,
            ItemDefinition source,
            ItemDefinition destination,
            string copyName)
        {
            Action action = () => sut.CopyItem(source, destination, copyName, null, null);

            action.ShouldThrow <ArgumentNullException>().Which.ParamName.Should().Be("copyId");
        }
示例#3
0
 public void CopyItemReturnsTrue(
     [Greedy] FakeDataProvider sut,
     ItemDefinition source,
     ItemDefinition destination,
     string copyName,
     ID copyId,
     CallContext context,
     DbItem sourceItem)
 {
     sut.DataStorage.GetFakeItem(source.ID).Returns(sourceItem);
     sut.CopyItem(source, destination, copyName, copyId, context)
     .Should().BeTrue();
 }
示例#4
0
        public void CopyItemThrowsIfNoDestinationItemFound(
            [Greedy] FakeDataProvider sut,
            ItemDefinition source,
            ItemDefinition destination,
            string copyName,
            ID copyId,
            CallContext context)
        {
            Action action = () => sut.CopyItem(source, destination, copyName, copyId, context);

            action.ShouldThrow <InvalidOperationException>()
            .WithMessage("Unable to copy item '{0}'. The source item '{1}' is not found."
                         .FormatWith(copyName, source.ID));
        }
示例#5
0
 public void CopyItemAddsCopiedItemToDataStorage(
     [Greedy] FakeDataProvider sut,
     ItemDefinition source,
     ItemDefinition destination,
     string copyName,
     ID copyId,
     CallContext context,
     DbItem sourceItem)
 {
     sut.DataStorage.GetFakeItem(source.ID).Returns(sourceItem);
     sut.CopyItem(source, destination, copyName, copyId, context);
     sut.DataStorage.Received().AddFakeItem(
         Arg.Is <DbItem>(i => i.Name == copyName &&
                         i.ID == copyId &&
                         i.TemplateID == source.TemplateID &&
                         i.ParentID == destination.ID));
 }
示例#6
0
        public void CopyItemThrowsIfSourceIsNull(FakeDataProvider sut)
        {
            Action action = () => sut.CopyItem(null, null, null, ID.Null, null);

            action.ShouldThrow <ArgumentNullException>().Which.ParamName.Should().Be("source");
        }