public void Create_FromFlexiOptionsBlock_ReturnsDefaultBlockOptionsIfThereIsNoFlexiOptionsBlock()
        {
            // Arrange
            BlockProcessor       dummyBlockProcessor = MarkdigTypesFactory.CreateBlockProcessor();
            Mock <IDummyOptions> dummyOptions        = _mockRepository.Create <IDummyOptions>();
            Mock <BlockOptionsFactory <IDummyOptions> > mockTestSubject = CreateMockBlockOptionsFactory();

            mockTestSubject.CallBase = true;
            mockTestSubject.Setup(t => t.TryGetFlexiOptionsBlock(dummyBlockProcessor)).Returns((FlexiOptionsBlock)null);

            // Act
            IDummyOptions result = mockTestSubject.Object.Create(dummyOptions.Object, dummyBlockProcessor);

            // Assert
            Assert.Same(dummyOptions.Object, result);
            _mockRepository.VerifyAll();
        }
        public void Create_FromLeafBlock_CreatesOptions()
        {
            // Arrange
            Mock <IDummyOptions> dummyClonedBlockOptions = _mockRepository.Create <IDummyOptions>();
            Mock <IDummyOptions> mockDummyOptions        = _mockRepository.Create <IDummyOptions>();

            mockDummyOptions.Setup(d => d.Clone()).Returns(dummyClonedBlockOptions.Object);
            Mock <IJsonSerializerService> mockJsonSerializerService = _mockRepository.Create <IJsonSerializerService>();

            mockJsonSerializerService.Setup(j => j.Populate(It.IsAny <JsonTextReader>(), dummyClonedBlockOptions.Object));
            BlockOptionsFactory <IDummyOptions> testSubject = CreateBlockOptionsFactory(mockJsonSerializerService.Object);

            // Act
            IDummyOptions result = testSubject.Create(mockDummyOptions.Object, _mockRepository.Create <LeafBlock>(null).Object);

            // Assert
            _mockRepository.VerifyAll();
            Assert.Same(dummyClonedBlockOptions.Object, result);
        }
        public void Create_FromFlexiOptionsBlock_CreatesOptions()
        {
            // Arrange
            BlockProcessor       dummyBlockProcessor     = MarkdigTypesFactory.CreateBlockProcessor();
            Mock <IDummyOptions> dummyClonedDummyOptions = _mockRepository.Create <IDummyOptions>();
            Mock <IDummyOptions> dummyOptions            = _mockRepository.Create <IDummyOptions>();
            var dummyFlexiOptionsBlock = new FlexiOptionsBlock(null);
            Mock <BlockOptionsFactory <IDummyOptions> > mockTestSubject = CreateMockBlockOptionsFactory();

            mockTestSubject.CallBase = true;
            mockTestSubject.Setup(t => t.TryGetFlexiOptionsBlock(dummyBlockProcessor)).Returns(dummyFlexiOptionsBlock);
            mockTestSubject.Setup(t => t.Create(dummyOptions.Object, dummyFlexiOptionsBlock)).Returns(dummyClonedDummyOptions.Object);

            // Act
            IDummyOptions result = mockTestSubject.Object.Create(dummyOptions.Object, dummyBlockProcessor);

            // Assert
            _mockRepository.VerifyAll();
            Assert.Same(dummyClonedDummyOptions.Object, result);
        }