Beispiel #1
0
        public async Task StoredDatesController_GetAll_Success()
        {
            var repositoryMoq = new Mock <IRepository <DateSelection> >();

            repositoryMoq.Setup(x => x.GetAll()).ReturnsAsync(SetupEntitySet()).Verifiable();
            var controller = new StoredDatesController(repositoryMoq.Object);
            var baseresult = await controller.GetDateSelections();

            Assert.NotNull(baseresult);
            Assert.True(baseresult.Any());
            repositoryMoq.Verify();
        }
Beispiel #2
0
        public async Task StoredDatesController_Add_Not_Success()
        {
            var repositoryMoq = new Mock <IRepository <DateSelection> >();

            repositoryMoq.Setup(x => x.Add(It.IsAny <DateSelection>())).Returns(Task.CompletedTask);
            var controller = new StoredDatesController(repositoryMoq.Object);
            var baseresult = await controller.AddDateSelection(SetupEmptyEntity());

            var result = Assert.IsType <BadRequestResult>(baseresult);

            Assert.Equal(400, result.StatusCode);
        }