Example #1
0
        public async Task DeleteAll_Ok()
        {
            var testResultEntities = TestEntitiesData.TestResultEntities;
            var testTableMock      = DatabaseTableDeleteTest.GetTestDatabaseTable(testResultEntities);
            var testDatabaseMock   = DatabaseMock.GetTestDatabase(testTableMock.Object);
            var testConverter      = TestEntityConverterMock.TestEntityConverter;
            var testService        = DatabaseServiceMock.GetTestDatabaseService(testDatabaseMock.Object, testTableMock.Object,
                                                                                testConverter);

            var resultEntity = await testService.Delete();

            Assert.True(resultEntity.OkStatus);
        }
Example #2
0
        public async Task Delete_DeleteError()
        {
            var testDelete         = TestData.TestDomains.Last();
            var testResultEntities = TestEntitiesData.TestResultEntities;
            var testTableMock      = DatabaseTableDeleteTest.GetTestDatabaseTable(testResultEntities,
                                                                                  DatabaseTableDeleteTest.DeleteErrorFunc());
            var testDatabaseMock = DatabaseMock.GetTestDatabase(testTableMock.Object);
            var testConverter    = TestEntityConverterMock.TestEntityConverter;
            var testService      = DatabaseServiceMock.GetTestDatabaseService(testDatabaseMock.Object, testTableMock.Object,
                                                                              testConverter);

            var resultEntity = await testService.Delete(testDelete.Id);

            Assert.True(resultEntity.HasErrors);
            Assert.Equal(ErrorResultType.DatabaseTableAccess, resultEntity.Errors.First().ErrorResultType);
        }
Example #3
0
        public async Task DeleteAll_DeleteError()
        {
            var errorInitial       = ErrorData.DatabaseError;
            var resultDelete       = new ResultError(errorInitial);
            var testResultEntities = TestEntitiesData.TestResultEntities;
            var testTableMock      = DatabaseTableDeleteTest.GetTestDatabaseTable(testResultEntities, resultDelete);
            var testDatabaseMock   = DatabaseMock.GetTestDatabase(testTableMock.Object);
            var testConverter      = TestEntityConverterMock.TestEntityConverter;
            var testService        = DatabaseServiceMock.GetTestDatabaseService(testDatabaseMock.Object, testTableMock.Object,
                                                                                testConverter);

            var resultEntity = await testService.Delete();

            Assert.True(resultEntity.HasErrors);
            Assert.True(errorInitial.Equals(resultEntity.Errors.First()));
        }