public async Task ValidatePut_Ok() { var test = TestData.TestDomains.First(); var testEntities = TestEntitiesData.TestEntities; var testIncludeValidateService = TestIncludeValidateServiceMock.GetTestIncludeValidateService(); var dbSetTest = TestDatabaseSetMock.GetDbSetTest(testEntities); var testTable = new TestTable(dbSetTest.Object); var testValidateService = new TestDatabaseValidateService(testTable, testIncludeValidateService.Object); var result = await testValidateService.ValidatePut(test); Assert.True(result.OkStatus); }
public async Task ValidatePut_ValidateIncludes() { var test = TestData.TestDomains.First(); var testEntities = TestEntitiesData.TestEntities; var testIncludeValidateService = TestIncludeValidateServiceMock.GetTestIncludeValidateService(TestIncludeValidateServiceMock.ValidateFindsError()); var dbSetTest = TestDatabaseSetMock.GetDbSetTest(testEntities); var testTable = new TestTable(dbSetTest.Object); var testValidateService = new TestDatabaseValidateService(testTable, testIncludeValidateService.Object); var result = await testValidateService.ValidatePut(test); Assert.True(result.HasErrors); Assert.True(result.Errors.First().ErrorResultType == ErrorResultType.ValueNotFound); }
public async Task ValidatePut_ValidateModelError() { var test = TestData.TestDomains.First(); var testInvalidName = new TestDomain(TestEnum.First, String.Empty, test.TestIncludes); var testEntities = TestEntitiesData.TestEntities; var testIncludeValidateService = TestIncludeValidateServiceMock.GetTestIncludeValidateService(); var dbSetTest = TestDatabaseSetMock.GetDbSetTest(testEntities); var testTable = new TestTable(dbSetTest.Object); var testValidateService = new TestDatabaseValidateService(testTable, testIncludeValidateService.Object); var result = await testValidateService.ValidatePut(testInvalidName); Assert.True(result.HasErrors); Assert.True(result.Errors.First().ErrorResultType == ErrorResultType.ValueNotValid); }