Пример #1
0
        public async Task GetWeighInSumAgreementAsyncTest_NullService()
        {
            var mockService = new Mock <IWeighInService>();

            mockService.Setup(w => w.GetWeighInSumAgreementAsync("", "", "")).Returns(Task.FromResult((WeighInSumAgreementDto[])null));
            var service = mockService.Object;

            var repo = new WeighInRepository(service);
            var list = await repo.GetWeighInSumAgreementAsync("", "", "");

            Assert.AreEqual(0, list.Length);
        }
Пример #2
0
        public async Task GetWeighInSumAgreementAsyncTest_LiveService()
        {
            var expected = new WeighInSumAgreementDto[1] {
                new WeighInSumAgreementDto {
                }
            };

            var mockService = new Mock <IWeighInService>();

            mockService.Setup(w => w.GetWeighInSumAgreementAsync("", "", "")).Returns(Task.FromResult(expected));
            var service = mockService.Object;

            var repo   = new WeighInRepository(service);
            var actual = await repo.GetWeighInSumAgreementAsync("", "", "");

            Assert.AreEqual(expected.Length, actual.Length);
            Assert.AreEqual(expected[0], actual[0]);
        }