예제 #1
0
        public void GetLineCallsMonth_RecivedLineNumber_RecivedLineCallsOfTheMonthFromDB()
        {
            var context = new PhoneCompanyContext
            {
                Calls = new Mock <DbSet <DbCall> >().Object
            };

            context.Calls = ModelsGenerateForUnitTests.GetQueryableMockDbSet(
                new Call
            {
                CallDate          = DateTime.Now,
                DestinationNumber = "0584313648",
                Duration          = 66,
                Id     = 1,
                LineId = 1
            }.CommonToDb());

            var results = context.Calls
                          .Select(c => c.DbToCommon()).FirstOrDefault();

            Assert.AreEqual(results.Id == 1, true);
        }
예제 #2
0
        public void GetLineCall_RecivedLineNumber_RecivedCallListFromDB()
        {
            var context = new PhoneCompanyContext
            {
                Calls = new Mock <DbSet <DbCall> >().Object
            };

            context.Calls = ModelsGenerateForUnitTests.GetQueryableMockDbSet(
                new Call
            {
                CallDate          = DateTime.MaxValue,
                DestinationNumber = "123123",
                Duration          = 66,
                Id     = 1,
                LineId = 1
            }.CommonToDb());

            var results = context.Calls
                          .Select(c => c.DbToCommon()).FirstOrDefault();

            Assert.AreEqual(results.DestinationNumber, "123123");
        }