Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public void RemoveTest(string line, bool expected, bool existsBefore)
        {
            // Arrange
            var retorts = new Retorts("test");

            retorts.Clear();
            var question = (!string.IsNullOrWhiteSpace(line)) ? line.Split("|")[1] : "";
            var answer   = "defaultAnswer1";

            if (existsBefore)
            {
                Assert.True(retorts.Add(question, answer));
            }

            // Act
            var result = retorts.Remove(line);

            // Assert
            Assert.Equal(expected, result);
        }