public SkillsFactoryTests()
 {
     _provider = new Mock <IConversationStateProvider>();
     _context  = new Mock <ITurnContext>();
     //var brainState = new BrainState();
     //_provider.Setup(p => p.GetConversationState<BrainState>(_context.Object))
     //    .Returns(brainState);
     _factory = SkillFactory.GetInstance();
 }
        public void GetInstanceTest()
        {
            // Arrange
            var factory = SkillFactory.GetInstance();

            // Act

            // Assert
            Assert.NotNull(factory);
        }
Exemple #3
0
        public void GetInstanceThroughFactoryTest()
        {
            // Arrange
            var brainState = new BrainState();

            _provider.Setup(p => p.GetConversationState <BrainState>(_context.Object))
            .Returns(brainState);
            var retorts = SkillFactory.GetInstance().GetSkill("retorts", _context.Object, _provider.Object);

            // Act

            // Assert
            Assert.NotNull(retorts);
        }
        public void CountAfterInitTest(int expected)
        {
            // Arrange
            var factory    = SkillFactory.GetInstance();
            var brainState = new BrainState();

            _provider.Setup(p => p.GetConversationState <BrainState>(_context.Object))
            .Returns(brainState);

            // Act
            var actual = SkillFactory.Count;

            // Assert
            Assert.Equal(expected, actual);
        }
        public void GetSkillNonexistingTest()
        {
            // Arrange
            var factory    = SkillFactory.GetInstance();
            var brainState = new BrainState();

            _provider.Setup(p => p.GetConversationState <BrainState>(_context.Object))
            .Returns(brainState);

            // Act
            var skill = factory.GetSkill("greetings_like_you_test_it", _context.Object, _provider.Object);

            // Assert
            Assert.Null(skill);
        }
        public void GetSkillExistingAgainTest()
        {
            // Arrange
            var factory    = SkillFactory.GetInstance();
            var brainState = new BrainState();

            _provider.Setup(p => p.GetConversationState <BrainState>(_context.Object))
            .Returns(brainState);

            // Act
            var skill  = factory.GetSkill("greetings", _context.Object, _provider.Object);
            var skill2 = factory.GetSkill("greetings", _context.Object, _provider.Object);

            // Assert
            Assert.Equal(skill, skill2);
        }
Exemple #7
0
        public void AboutTest()
        {
            // Arrange
            var expected   = "Contains set of quick responses from easily extendable file.";
            var brainState = new BrainState();

            _provider.Setup(p => p.GetConversationState <BrainState>(_context.Object))
            .Returns(brainState);
            var retorts = SkillFactory.GetInstance().GetSkill("retorts", _context.Object, _provider.Object);

            // Act
            var actual = retorts.About;

            // Assert
            Assert.NotNull(actual);
            Assert.NotEmpty(actual);
            Assert.Equal(expected, actual);
        }
        public void ClearAfterInitSingleSkillTest(int expected)
        {
            // Arrange
            var factory    = SkillFactory.GetInstance();
            var brainState = new BrainState();

            _provider.Setup(p => p.GetConversationState <BrainState>(_context.Object))
            .Returns(brainState);

            // Act
            SkillFactory.Clear();
            var skill = factory.GetSkill("greetings", _context.Object, _provider.Object);

            SkillFactory.Clear();
            var actual = SkillFactory.Count;

            // Assert
            Assert.Equal(expected, actual);
        }
Exemple #9
0
        public void ProcessTest(string request, string expected)
        {
            // Arrange
            var brainState = new BrainState();

            _provider.Setup(p => p.GetConversationState <BrainState>(_context.Object))
            .Returns(brainState);
            var     skills  = SkillFactory.GetInstance(_context.Object, _provider.Object);
            Retorts retorts = Retorts.Instance(_context.Object, _provider.Object);
            // TODO add call to load retorts from file
            var resultOfAdd = retorts.Add("hi", "hello");

            // Act
            var  actual  = retorts.Process(request);
            bool removal = retorts.Remove("hi");

            // Assert
            Assert.Equal(expected, actual);
        }
        public void ProcessTest(string given)
        {
            // Arrange
            var factory    = SkillFactory.GetInstance(_context.Object, _provider.Object);
            var brainState = new BrainState();

            _provider.Setup(p => p.GetConversationState <BrainState>(_context.Object))
            .Returns(brainState);

            // Act
            var skill  = factory.GetSkill("greetings", _context.Object, _provider.Object);
            var actual = factory.Process(given);

            // Assert
            if (given != null && given.Equals("hi"))
            {
                Assert.NotNull(actual);
            }
            else
            {
                Assert.Null(actual);
            }
        }