public void IsCollectionRegistered_CollectionRegisteredAndDropped_False()
        {
            TestInstance.RegisterCollection(Collection, Descriptor, DataBuilder);
            TestInstance.DropCollection(Collection);

            Assert.IsFalse(TestInstance.IsCollectionRegistered(Collection));
        }
        public void DropCollection__DelegatedToRepository()
        {
            MockedTestInstance.Setup(_ => _.GetRepository <IData>()).Returns(DataRepository);

            TestInstance.DropCollection(Collection);

            MockedDataRepository.Verify(_ => _.DropCollection(Collection));
        }
        public void DropCollection_CollectionNotRegistered_CollectionNotCleared()
        {
            MockedTestInstance.Setup(_ => _.IsCollectionRegistered(It.IsAny <ICollection <IData> >())).Returns(false);
            MockedTestInstance.Setup(_ => _.ClearCollection(It.IsAny <ICollection <IData> >()));
            MockedTestInstance.Setup(_ =>
                                     _.DropCollection(It.IsAny <ICollection <IData> >(), It.IsAny <INonTerminalDescriptor>()));
            MockedTestInstance.Setup(_ => _.GetDescriptor(It.IsAny <ICollection <IData> >()));

            TestInstance.DropCollection(Collection);

            MockedTestInstance.Verify(_ => _.ClearCollection(It.IsAny <ICollection <IData> >()), Times.Never);
        }
        public void DropCollection_CollectionRegistered_CollectionDroppedCorrectly()
        {
            MockedTestInstance.Setup(_ => _.IsCollectionRegistered(It.IsAny <ICollection <IData> >())).Returns(true);
            MockedTestInstance.Setup(_ => _.ClearCollection(It.IsAny <ICollection <IData> >()));
            MockedTestInstance.Setup(_ =>
                                     _.DropCollection(It.IsAny <ICollection <IData> >(), It.IsAny <INonTerminalDescriptor>()));
            MockedTestInstance.Setup(_ => _.GetDescriptor(It.IsAny <ICollection <IData> >())).Returns(Descriptor);

            TestInstance.DropCollection(Collection);

            MockedTestInstance.Verify(_ => _.GetDescriptor(Collection));
            MockedTestInstance.Verify(_ => _.DropCollection(Collection, Descriptor));
        }
示例#5
0
        public void DropCollection__DelegatesToCollectionsManager()
        {
            TestInstance.DropCollection(Collection);

            MockedCollectionsManager.Verify(_ => _.DropCollection(Collection));
        }