Esempio n. 1
0
        public void ChainEquals_WithNull_ReturnsFalse()
        {
            // Arrange
            var c1 = new MessageChain(new List <MessageElement> {
                new Plain("While I am a cat.")
            });
            // Act
            var assert = c1.ChainEquals(null);

            // Assert
            Assert.IsFalse(assert);
        }
Esempio n. 2
0
        public void ChainEquals_WithNull_ReturnsFalse()
        {
            // Arrange
            MessageChain c1 = new MessageChain(new List <MessageComponent>()
            {
                new Plain("While I am a cat.")
            });
            // Act
            bool assert = c1.ChainEquals(null);

            // Assert
            Assert.IsFalse(assert);
        }
Esempio n. 3
0
        public void ChainEquals_WithSame_ReturnsTrue()
        {
            // Arrange
            var c1 = new MessageChain(new List <MessageElement> {
                new Plain("While I am a cat.")
            });
            var c2 = new MessageChain(new List <MessageElement> {
                new Plain("While I am a cat.")
            });
            // Act
            var assert = c1.ChainEquals(c2);

            // Assert
            Assert.IsTrue(assert);
        }
Esempio n. 4
0
        public void Build_SameComponents_ReturnsRightChain()
        {
            // Arrange
            MessageChainBuilder builder = new MessageChainBuilder();

            builder.AddPlain("While I am a cat.");
            MessageChain comp = new MessageChain(new List <MessageComponent>()
            {
                new Plain("While I am a cat.")
            });
            // Act
            MessageChain chain = builder.Build();

            // Assert
            Assert.IsTrue(chain.ChainEquals(comp));
        }
Esempio n. 5
0
        public void ChainEquals_WithSame_ReturnsTrue()
        {
            // Arrange
            MessageChain c1 = new MessageChain(new List <MessageComponent>()
            {
                new Plain("While I am a cat.")
            });
            MessageChain c2 = new MessageChain(new List <MessageComponent>()
            {
                new Plain("While I am a cat.")
            });
            // Act
            bool assert = c1.ChainEquals(c2);

            // Assert
            Assert.IsTrue(assert);
        }
Esempio n. 6
0
        public void Parse_Same()
        {
            // A
            MessageChainBuilder builder = new MessageChainBuilder();

            builder.Add(new Source(1024));
            builder.AddPlain("World");
            builder.Add(new Image("{3A9B96FE-FDB8-D597-560A-3517A8031F5A}.mirai", new Uri("http://gchat.qpic.cn/gchatpic_new/2419328026/594429092-2161359014-3A9B96FEFDB8D597560A3517A8031F5A/0?term=2")));
            builder.AddPlain("Hello");
            MessageChain    chain  = builder.Build();
            HyperCodeParser parser = new HyperCodeParser();
            // A
            MessageChain res = parser.Parse("[hyper.source(1024)]World[hyper.image({3A9B96FE-FDB8-D597-560A-3517A8031F5A}.mirai,http://gchat.qpic.cn/gchatpic_new/2419328026/594429092-2161359014-3A9B96FEFDB8D597560A3517A8031F5A/0?term=2)]Hello");

            // A
            Assert.IsTrue(chain.ChainEquals(res));
        }