Esempio n. 1
0
        private void GetAll()
        {
            mapper = new AutoMapperTest();
            mapper.Reset();
            mapper.IsValidConfiguration();
            _mock.Setup(m => m.GetAllUsers())
            .Returns(_listUserSettings);
            _mockUW.Setup(m => m.UserSettingsRepository.GetAllAsync(false)).Returns(_listEntitiesUserSettings);
            var actionResult = _controller.GetAllAsync();

            Assert.NotNull(actionResult);
        }
Esempio n. 2
0
        private async Task AddAsync()
        {
            mapper = new AutoMapperTest();
            mapper.Reset();
            mapper.IsValidConfiguration();
            var genericIdentity = new API.Authorization.User("4", true, "dummyUser", API.Authorization.User.IarUserTypes.User, "", "", DateTime.Now, 125625, 168);

            _controller = new UserSettingsController(_mock.Object, _mockUW.Object, new ApplicationContext(genericIdentity));
            UserSettingsModel dummyUSM = new UserSettingsModel();
            UserSetting       dummyUS  = new UserSetting();

            _mock.Setup(m => m.GetById(It.IsAny <Int32>()));
            _mock.Setup(m => m.Add(userSetting));
            _mockUW.Setup(m => m.UserSettingsRepository.InsertAsync(entityUserSetting, false));
            userSetting.Id    = 2;
            userSetting.Items = items;
            var actionResult = await _controller.AddAsync(A.Fake <UserSettingsModel>());

            Assert.Null(actionResult);
        }
Esempio n. 3
0
        private async Task GetAsync()
        {
            mapper = new AutoMapperTest();
            mapper.Reset();
            mapper.IsValidConfiguration();
            UserSettingsModel dummyUSM = new UserSettingsModel();

            Entities.UserSetting userSettingsReturn = new UserSetting();
            var genericIdentity = new API.Authorization.User("4", true, "dummyUser", API.Authorization.User.IarUserTypes.User, "", "", DateTime.Now, 125625, 168);

            _controller = new UserSettingsController(_mock.Object, _mockUW.Object, new ApplicationContext(genericIdentity));
            _mockBC.Setup(m => m.Accepted());
            User user = new User();

            _mock.Setup(m => m.GetById(It.IsAny <int>()))
            .Returns(dummyUSM);
            Assert.NotNull(dummyUSM);
            _mockUW.Setup(m => m.UserSettingsRepository.GetDefaultSettings()).Returns(userSettingsReturn);
            _mockUW.Setup(m => m.UserSettingsRepository.GetByAsync(x => x.Id == It.IsAny <int>(), false));
            var actionResult = await _controller.GetAsync(1);

            Assert.NotNull(actionResult);
        }