Пример #1
0
        public async void RecordAdded_RecordCorrect_RecordEqualRecordInDatabase()
        {
            // arrange
            var userAuth = GetUserAuth();

            fixture.dbAuth.Add(userAuth);

            var expected = GetLogRecord();
            await httpContextAccessor.SignIn("admin", "admin");

            // act
            await logProvider.AddToLogAsync("Record in a log");

            var actual = fixture.dbAuth.LogRecord.FirstOrDefault(i => i.UserLogin == expected.UserLogin);

            // assert
            Assert.Equal(expected.UserLogin, actual.UserLogin);
            Assert.Equal(expected.UserIP, actual.UserIP);
            Assert.Equal(expected.Record, actual.Record);
        }
Пример #2
0
        public async void CheckRemoveCurrentUser_FromInitializedDbTable_ErrorHandlerIsCompletedFalse()
        {
            // arrange
            var userData = GetUserData();
            var userAuth = GetUserAuth();

            fixture.dbAuth.Add(userData);
            fixture.dbAuth.Add(userAuth);
            await fixture.dbAuth.SaveChangesAsync();

            await contextAccessor.SignIn("admin", "admin");

            // act
            var statusMessage = await logicValidation.CheckRemoveDataModelAsync(userData.Login);

            // teardown
            await contextAccessor.SignOut();

            // assert
            Assert.False(statusMessage.IsCompleted);
        }