Esempio n. 1
0
        public void ProductDoc_Field_D_Conver_To_Integer_Fail_Log()
        {
            //arrange
            ILog log = Substitute.For <ILog>();
            GroupTotal <string, string> target = new GroupTotal <string, string>(log);

            //act
            target.SetCollections(_ProductDoc);
            List <int> actual = target.GetGroupSum("D", 2);

            //assert
            log.Received(3).Save(Arg.Is <string>(x => x.Contains("D") && x.Contains("convert") && x.Contains("Integer failed")));
        }
Esempio n. 2
0
        public void Lack_Field_C_isNotExist_Log()
        {
            //arrange
            ILog log = Substitute.For <ILog>();
            GroupTotal <string, int> target = new GroupTotal <string, int>(log);

            //List<int> expected = new List<int> { 1, 0, 11 };

            //act
            target.SetCollections(_Lacks);
            List <int> actual = target.GetGroupSum("C", 2);

            //assert
            //CollectionAssert.AreEqual(expected, actual);
            log.Received(3).Save(Arg.Is <string>(x => x.Contains("C") && x.Contains("get Value failed")));
        }
Esempio n. 3
0
        public void ProductDoc_Field_E_Total_Group_5()
        {
            //arrange
            ILog log = Substitute.For <ILog>();
            GroupTotal <string, string> target = new GroupTotal <string, string>(log);
            List <int> expected = new List <int> {
                1, 3, 5
            };

            //act
            target.SetCollections(_ProductDoc);
            List <int> actual = target.GetGroupSum("E", 2);

            //assert
            CollectionAssert.AreEqual(expected, actual);
        }
Esempio n. 4
0
        public void Lack_Field_C_Total_Group_2()
        {
            //arrange
            ILog log = Substitute.For <ILog>();
            GroupTotal <string, int> target = new GroupTotal <string, int>(log);
            List <int> expected             = new List <int> {
                3, 4, 0
            };

            //act
            target.SetCollections(_Lacks);
            List <int> actual = target.GetGroupSum("B", 2);

            //assert
            CollectionAssert.AreEqual(expected, actual);
        }
Esempio n. 5
0
        public void Coffee_Field_CC_Total_Group_4()
        {
            //arrange
            ILog log = Substitute.For <ILog>();
            GroupTotal <string, int> target = new GroupTotal <string, int>(log);
            List <int> expected             = new List <int> {
                23, 27, 31, 35
            };

            //act
            target.SetCollections(_Coffees);
            List <int> actual = target.GetGroupSum("CC", 2);

            //assert
            CollectionAssert.AreEqual(expected, actual);
        }
Esempio n. 6
0
        public void Products_Field_UnKnown_Total_0()
        {
            //arrange
            ILog log = Substitute.For <ILog>();
            GroupTotal <string, int> target = new GroupTotal <string, int>(log);
            List <int> expected             = new List <int> {
                0, 0, 0
            };

            //act
            target.SetCollections(_Products);
            List <int> actual = target.GetGroupSum("UnKnown", 4);

            //assert
            CollectionAssert.AreEqual(expected, actual);
        }
Esempio n. 7
0
        public void Products_Field_Cost_Total_Group_3()
        {
            //arrange
            ILog log = Substitute.For <ILog>();
            GroupTotal <string, int> target = new GroupTotal <string, int>(log);
            List <int> expected             = new List <int> {
                6, 15, 24, 21
            };

            //act
            target.SetCollections(_Products);
            List <int> actual = target.GetGroupSum("Cost", 3);

            //assert
            CollectionAssert.AreEqual(expected, actual);
        }