示例#1
0
        public void TestAddLog()
        {
            //arrange
            LocalWordDB sut = new LocalWordDB();

            sut.CreateDatabase();

            sut.TryAddLog("b:576847", "{'hdjkh':'result'}").Should().BeTrue();
            //act-assert
            //restore
            sut.DeleteDatabase();
        }
示例#2
0
        public void TestNotTodayCountLog(int year, int month, int day)
        {
            //arrange
            var         date = new DateTime(year, month, day);
            LocalWordDB sut  = new LocalWordDB();

            sut.CreateDatabase();

            sut.TryAddLog("b:576847", "{'hdjkh':'result'}").Should().BeTrue();
            //act-assert
            sut.GetBabelRequestsCount(date).Should().Be(0);
            //restore
            sut.DeleteDatabase();
        }
示例#3
0
        public void TestTodayCountLog()
        {
            //arrange
            var         date = DateTime.Now;
            LocalWordDB sut  = new LocalWordDB();

            sut.CreateDatabase();

            sut.TryAddLog("b:576847", "{'hdjkh':'result'}").Should().BeTrue();
            //act-assert
            sut.GetBabelRequestsCount(date).Should().Be(1);
            sut.GetTodayBabelRequestsCount().Should().Be(1);
            //restore
            sut.DeleteDatabase();
        }
示例#4
0
        public void TestTodayMultipleCountLog(int count)
        {
            //arrange
            LocalWordDB sut = new LocalWordDB();

            sut.CreateDatabase();
            for (int i = 0; i < count; i++)
            {
                sut.TryAddLog(Guid.NewGuid().ToString(), Guid.NewGuid().ToString()).Should().BeTrue();
            }

            //act-assert
            sut.GetTodayBabelRequestsCount().Should().Be(count);

            //restore
            sut.DeleteDatabase();
        }