コード例 #1
0
        public void MethodExamineTest()
        {
            //Arrange
            var    pop1 = new PopCorn(43, "Estrella", "Made in Sweden");
            string expectedExaminationContent1 = "Estrella \t\t43 kr. \tMade in Sweden";

            //Act
            string actualUsage = pop1.Examine();

            //Assert
            Assert.Equal(expectedExaminationContent1, actualUsage);
        }
コード例 #2
0
        public void NormalConstructorCheckAllMethodsTest()
        {
            //Arrange
            string name  = "OLW";
            string info  = "500 g";
            string usage = "Eat the popcorn and have fun!";
            int    price = 18;

            //Act
            var    pop1          = new PopCorn(price, name, info);
            string examineString = pop1.Examine();
            string usageString   = pop1.Use();

            //Assert
            //check Examine method
            Assert.Contains(name, examineString);
            Assert.Contains(info, examineString);
            Assert.Contains(price.ToString(), examineString);

            //check Use method
            Assert.Contains(usage, usageString);
        }