public async Task Should_allocate_ejud_joh_user() { var users = new List <UserDto>(); const string EMAIL_STEM = EmailData.FAKE_EMAIL_STEM; var judge = new EjudUserBuilder(EMAIL_STEM, 1).AddJudge().BuildUserDto(); users.Add(judge); QueryHandler .Setup(x => x.Handle <GetAllUsersByFilterQuery, List <UserDto> >(It.IsAny <GetAllUsersByFilterQuery>())) .ReturnsAsync(users); var allocation = CreateAllocation(judge); QueryHandler .Setup(x => x.Handle <GetAllocationByUserIdQuery, Allocation>(It.IsAny <GetAllocationByUserIdQuery>())) .ReturnsAsync(allocation); QueryHandler .Setup(x => x.Handle <GetUserByIdQuery, UserDto>(It.IsAny <GetUserByIdQuery>())) .ReturnsAsync(judge); CommandHandler .Setup(x => x.Handle(It.IsAny <AllocateByUserIdCommand>())) .Returns(Task.CompletedTask); var allocatedUser = await AllocationService.AllocateJudicialOfficerHolderToService(judge.TestType); allocatedUser.Should().BeEquivalentTo(judge); }
private void displayAllocationDetails(string TANFileContent, string configFileContent) { var allocations = TaskAllocationFileParser.GetAllocations(TANFileContent); foreach (var allocation in allocations) { float allocationRuntime = AllocationService.GetAllocationRuntime(configFileContent, allocation.Value); string allocationRuntimeErrorMsg = AllocationService.IsAllocationRuntimeValid(configFileContent, allocationRuntime); displayAllocation(allocation); if (allocationRuntimeErrorMsg == "") { float energyConsumed = AllocationService.GetTotalEnergyConsumed(configFileContent, allocation.Value); mainFormTextBox.AppendText($"Time = {allocationRuntime}, Energy = {energyConsumed}"); } else { mainFormTextBox.AppendText(allocationRuntimeErrorMsg); } mainFormTextBox.AppendText(Environment.NewLine); mainFormTextBox.AppendText(Environment.NewLine); } }
/// <summary> /// 手动配货 /// </summary> /// <param name="orderIds"></param> /// <returns></returns> public ActionResult Allocate(string orderIds) { try { var sb = new StringBuilder(); var allocationService = new AllocationService(); string[] aryOrderId = orderIds.Split(','); foreach (string orderId in aryOrderId) { string message; bool flag = allocationService.OrderAllocate(orderId, out message); if (!flag) { sb.AppendFormat("{0}<br/>", message); } else { sb.AppendFormat("{0}<br/>", message); } } WriteLog(1, orderIds, sb.ToString()); return(Content(new JsonMessage { Success = true, Code = "1", Message = sb.ToString() }.ToString())); } catch (Exception ex) { WriteLog(-1, orderIds, "操作失败:" + ex.Message); return(Content(new JsonMessage { Success = false, Code = "-1", Message = "操作失败:" + ex.Message }.ToString())); } }
static void Main(string[] args) { var globalStorage = GlobalStorage.Instance; IFileService fileService = new FileService(globalStorage); IAllocationService allocationService = new AllocationService(globalStorage); IPromotionService promotionService = new PromotionService(globalStorage); IBalanceService balanceService = new BalanceService(globalStorage); IConsoleService consoleService = new ConsoleService(); consoleService.ShowInitialInformation(); var option = string.Empty; while (option != Commands.exit) { var optionSplit = GetConsoleParameters(); option = optionSplit[0]; try { switch (option) { case Commands.allocate: globalStorage.Teams = allocationService.Allocate(globalStorage.Teams, globalStorage.EmployeesFromFile); consoleService.ShowTeamsAndEmployees(globalStorage.Teams); break; case Commands.balance: globalStorage.Teams = balanceService.BalanceTeams(globalStorage.Teams); consoleService.ShowTeamsAndEmployees(globalStorage.Teams); break; case Commands.load: globalStorage.Teams = fileService.LoadFileTeam(optionSplit.ElementAtOrDefault(1)); globalStorage.EmployeesFromFile = fileService.LoadFileEmployee(optionSplit.ElementAtOrDefault(2)); Console.WriteLine(Messages.MSG002); break; case Commands.promote: promotionService.Promote(optionSplit.ElementAtOrDefault(1)); break; case Commands.showTeams: consoleService.ShowTeamsAndEmployeesDetail(globalStorage.Teams); break; case Commands.exit: break; default: Console.WriteLine(Messages.MSG001); break; } } catch (BusinessException e) { Console.WriteLine(e.Message); } } }
public void DeleteAllocationTest() { // Get a test user var testUser = GetTestUser(); var testCompany = GetTestCompany(testUser); // Create a record var productList = FindProductsForTest(db.FindParentCompany(), 1); Assert.IsTrue(productList.Count() > 0, "Error: No products were returned for the parent company. This could be because the parent company has not been flagged or it has no allocations"); AllocationModel model = createAllocation(testCompany, productList[0]); var error = AllocationService.InsertOrUpdateAllocation(model, testUser, ""); Assert.IsTrue(!error.IsError, error.Message); // Check that it was written var result = db.FindAllocation(model.Id); var test = AllocationService.MapToModel(result); AreEqual(model, test); // Now delete it AllocationService.DeleteAllocation(model.Id); // And check that is was deleted result = db.FindAllocation(model.Id); Assert.IsTrue(result == null, "Error: A non-NULL value was returned when a NULL value was expected - record delete failed"); }
public ActionResult GetAllocations(int index, int parentId, int pageNo, int pageSize, string search) { // On entry, parentId is the Id of the PurchaseOrderHeaderTemp var model = createModel(parentId); return(Json(AllocationService.FindAllocationsListModel(parentId, index, pageNo, pageSize, search), JsonRequestBehavior.AllowGet)); }
public void GivenAnAllocationService_WhenStartAllocationWithDiffLiceplate_ThenExecptionThrown() { //Given Allocation startAllocation = new Allocation() { MemberPersonId = 1, ParkinglotId = 1 }; Parkinglot parkinglot = new Parkinglot() { Id = 1 }; _parkinglotService.GetOneParkinglot(1).Returns(parkinglot); _personService.GetById(1).Returns(_testPerson); _parkinglotService.ReduceAvailableParkingSpots(parkinglot).Returns(true); _allocationRepository.SaveNewAllocation(startAllocation).Returns(startAllocation); var allocationService = new AllocationService(_allocationRepository, _parkinglotService, _personService); //When Action action = () => allocationService.StartAllocation(startAllocation, new LicensePlate("Fout", "BE")); //Then var exception = Assert.Throws <EntityNotValidException>(action); Assert.Contains("the following entity was found to be invalid", exception.Message); }
public void Should_throw_error_when_all_users_allocated() { var users = new List <UserDto>(); const string EMAIL_STEM = EmailData.FAKE_EMAIL_STEM; var judge = new EjudUserBuilder(EMAIL_STEM, 1).AddJudge().BuildUserDto(); users.Add(judge); QueryHandler .Setup(x => x.Handle <GetAllUsersByFilterQuery, List <UserDto> >(It.IsAny <GetAllUsersByFilterQuery>())) .ReturnsAsync(users); var allocation = CreateAllocation(judge); const int ALLOCATE_FOR_MINUTES = 1; allocation.Allocate(ALLOCATE_FOR_MINUTES, EmailData.TEST_WEB_MANUAL_USER); QueryHandler .Setup(x => x.Handle <GetAllocationByUserIdQuery, Allocation>(It.IsAny <GetAllocationByUserIdQuery>())) .ReturnsAsync(allocation); Assert.ThrowsAsync <AllUsersAreAllocatedException>(async() => await AllocationService.AllocateJudicialOfficerHolderToService(TestType.Automated)); }
public void Should_throw_error_if_no_ejud_users_exist() { QueryHandler .Setup(x => x.Handle <GetAllUsersByFilterQuery, List <UserDto> >(It.IsAny <GetAllUsersByFilterQuery>())) .ReturnsAsync(new List <UserDto>()); Assert.ThrowsAsync <NoEjudUsersExistException>(async() => await AllocationService.AllocateJudicialOfficerHolderToService(TestType.Automated)); }
public async Task Should_allocate_existing_user_with_allocations_does_not_exist_in_aad() { const int NUMBER_OF_USERS = 3; var users = CreateListOfUsers(UserType.Individual, NUMBER_OF_USERS); var allocations = CreateAllocations(users); allocations.Count.Should().Be(NUMBER_OF_USERS); QueryHandler .Setup(x => x.Handle <GetAllUsersByFilterQuery, List <UserDto> >(It.IsAny <GetAllUsersByFilterQuery>())) .ReturnsAsync(users); QueryHandler .SetupSequence(x => x.Handle <GetAllocationByUserIdQuery, Allocation>(It.IsAny <GetAllocationByUserIdQuery>())) .ReturnsAsync(allocations[0]) .ReturnsAsync(allocations[1]) .ReturnsAsync(allocations[2]); var user = users.First(); QueryHandler .Setup(x => x.Handle <GetUserByIdQuery, UserDto>(It.IsAny <GetUserByIdQuery>())) .ReturnsAsync(user); MockUserApiService .Setup(x => x.CheckUserExistsInAAD(It.IsAny <string>())) .ReturnsAsync(false); var newUserResponse = new NewUserResponse { OneTimePassword = "******", UserId = "1234", Username = user.Username }; MockUserApiService .Setup(x => x.CreateNewUserInAAD(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>())) .ReturnsAsync(newUserResponse); const int NUMBER_OF_USER_GROUPS = 2; MockUserApiService .Setup(x => x.AddGroupsToUser(It.IsAny <UserDto>(), It.IsAny <string>())) .ReturnsAsync(NUMBER_OF_USER_GROUPS); CommandHandler .Setup(x => x.Handle(It.IsAny <AllocateByUserIdCommand>())) .Returns(Task.CompletedTask); const int MINUTES = 1; var allocatedUser = await AllocationService.AllocateToService(user.UserType, user.Application, user.TestType, user.IsProdUser, MINUTES); allocatedUser.Should().BeEquivalentTo(user); }
public async Task Should_allocate_new_user_no_users_exist_user_exists_in_aad() { const string ALLOCATED_BY = EmailData.TEST_WEB_MANUAL_USER; var users = new List <UserDto>(); QueryHandler .Setup(x => x.Handle <GetAllUsersByFilterQuery, List <UserDto> >(It.IsAny <GetAllUsersByFilterQuery>())) .ReturnsAsync(users); const int NUMBER = 1; QueryHandler .Setup(x => x.Handle <GetNextUserNumberByUserTypeQuery, Integer>(It.IsAny <GetNextUserNumberByUserTypeQuery>())) .ReturnsAsync(new Integer(NUMBER)); CommandHandler .Setup(x => x.Handle(It.IsAny <CreateNewUserCommand>())) .Returns(Task.CompletedTask); var user = CreateNewUser(UserType.Individual, NUMBER); QueryHandler .Setup(x => x.Handle <GetUserByUserTypeAppAndNumberQuery, UserDto>( It.IsAny <GetUserByUserTypeAppAndNumberQuery>())) .ReturnsAsync(user); var allocation = CreateAllocation(user); allocation.AllocatedBy = ALLOCATED_BY; CommandHandler .Setup(x => x.Handle(It.IsAny <CreateNewAllocationByUserIdCommand>())) .Returns(Task.FromResult(allocation)); QueryHandler .Setup(x => x.Handle <GetUserByIdQuery, UserDto>(It.IsAny <GetUserByIdQuery>())) .ReturnsAsync(user); MockUserApiService .Setup(x => x.CheckUserExistsInAAD(It.IsAny <string>())) .ReturnsAsync(true); CommandHandler .Setup(x => x.Handle(It.IsAny <AllocateByUserIdCommand>())) .Returns(Task.CompletedTask); const int MINUTES = 1; var allocatedUser = await AllocationService.AllocateToService(user.UserType, user.Application, user.TestType, user.IsProdUser, MINUTES, ALLOCATED_BY); allocatedUser.Should().BeEquivalentTo(user); }
public void AllocationService_Add_ShouldBeFail() { Allocation modelo = ObjectMother.GetInvalidEndHourAllocation(ObjectMother.GetEmployee(), ObjectMother.GetRoom()); AllocationService service = new AllocationService(_mockRepository.Object); Action comparison = () => service.Save(modelo); comparison.Should().Throw <AllocationEndHourEarlyThanStartException>(); _mockRepository.VerifyNoOtherCalls(); }
public void AllocationService_GetAll_ShouldBeOk() { _mockRepository.Setup(m => m.GetAll()).Returns(new List <Allocation>()); AllocationService service = new AllocationService(_mockRepository.Object); IEnumerable <Allocation> result = service.GetAll(); result.Should().NotBeNull(); _mockRepository.Verify(repository => repository.GetAll()); }
public void PostService_Get_Invalid_Id_ShouldBeFail() { AllocationService service = new AllocationService(_mockRepository.Object); Allocation allocation = new Allocation() { Id = 0 }; Action comparison = () => service.Update(allocation); comparison.Should().Throw <IdentifierUndefinedException>(); _mockRepository.VerifyNoOtherCalls(); }
public void GetTotalEnergyConsumedTest() { // Arrange string configFileContent = @" // Task runtimes are based on tasks executing on // a processor running at the following frequency (GHz). RUNTIME-REFERENCE-FREQUENCY,1 // Task IDs and their runtime values. TASK-ID,RUNTIME 1,1 2,1 3,1 4,1 5,1 // Processor IDs and their frequency values. PROCESSOR-ID,FREQUENCY 1,1 2,1 3,1 // Quadratic coefficient IDs and their values. COEFFICIENT-ID,VALUE 0,1 1,1 2,1 "; List <List <bool> > allocation = new List <List <bool> >(); List <bool> processor1 = new List <bool>() { true, true, false, false, false }; List <bool> processor2 = new List <bool>() { false, false, true, true, false }; List <bool> processor3 = new List <bool>() { false, false, false, false, true }; allocation.Add(processor1); allocation.Add(processor2); allocation.Add(processor3); // Act float energyConsumed = AllocationService.GetTotalEnergyConsumed(configFileContent, allocation); // Assert Assert.AreEqual(15, Math.Round(energyConsumed, 2)); }
public async Task Should_allocate_existing_user_with_no_allocations_exists_in_aad() { const int NUMBER_OF_USERS = 3; var users = CreateListOfUsers(UserType.Individual, NUMBER_OF_USERS); QueryHandler .Setup(x => x.Handle <GetAllUsersByFilterQuery, List <UserDto> >(It.IsAny <GetAllUsersByFilterQuery>())) .ReturnsAsync(users); var allocations = CreateAllocations(users); QueryHandler .SetupSequence(x => x.Handle <GetAllocationByUserIdQuery, Allocation>(It.IsAny <GetAllocationByUserIdQuery>())) .ReturnsAsync((Allocation)null) .ReturnsAsync(allocations[0]) .ReturnsAsync((Allocation)null) .ReturnsAsync(allocations[1]) .ReturnsAsync((Allocation)null) .ReturnsAsync(allocations[2]); CommandHandler .Setup(x => x.Handle(It.IsAny <CreateNewAllocationByUserIdCommand>())) .Returns(Task.CompletedTask); var user = users.First(); QueryHandler .Setup(x => x.Handle <GetUserByIdQuery, UserDto>(It.IsAny <GetUserByIdQuery>())) .ReturnsAsync(user); MockUserApiService .Setup(x => x.CheckUserExistsInAAD(It.IsAny <string>())) .ReturnsAsync(true); var recentUser = new RecentUser(user.Username); QueryHandler .Setup( x => x.Handle <GetRecentUserByUsernameQuery, RecentUser>(It.IsAny <GetRecentUserByUsernameQuery>())) .ReturnsAsync(recentUser); CommandHandler .Setup(x => x.Handle(It.IsAny <AllocateByUserIdCommand>())) .Returns(Task.CompletedTask); const int MINUTES = 1; var allocatedUser = await AllocationService.AllocateToService(user.UserType, user.Application, user.TestType, user.IsProdUser, MINUTES); allocatedUser.Should().BeEquivalentTo(user); }
/// <summary> /// Gets ClearAllocationService /// </summary> public AllocationService GetAllocationService() { if (allocationService == null) { allocationService = new AllocationService(); allocationService.ResourcePath = AllocationResourcePath.ALLOCATION_RESOURCE_PATH; allocationService.SocketResourcePath = AllocationResourcePath.SOCKET_ALLOCATION_RESOURCE_PATH; allocationService.FileService = GetFileService(); allocationService.GroupService = GetGroupService(); configureService(allocationService); } return(allocationService); }
public void AllocationService_Update_Invalid_Id_ShouldBeFail() { Allocation modelo = ObjectMother.GetAllocation(ObjectMother.GetEmployee(), ObjectMother.GetRoom()); modelo.Id = 0; AllocationService service = new AllocationService(_mockRepository.Object); Action update = () => service.Update(modelo); update.Should().Throw <IdentifierUndefinedException>(); _mockRepository.VerifyNoOtherCalls(); }
public async Task Can_Get_Allocation() { var pageReader = new TestFileReader(new [] { @".\TestPages\Allocation\GamPage1.txt" }); var service = new AllocationService(pageReader); var result = await service.GetAllocation(1, new PageAddress(1, 2), 1024); Assert.IsNotNull(result); }
public void GetTaskRuntimeTest() { // Arrange float referenceFrequency = 2; float runtime = 1; float frequency = 1; // Act float taskRuntime = AllocationService.GetTaskRuntime(referenceFrequency, runtime, frequency); // Assert Assert.AreEqual(2, taskRuntime); }
private void CalculateAllocations() { var result = AllocationService.GetAllAllocations(_allAssetsFromService); AllAllocations = new ObservableCollection <AllocationDto>(); if (!result.Succeeded) { MessageBox.Show(result.ErrorMessage, "Error in Calculate Allocation"); return; } AllAllocations = new ObservableCollection <AllocationDto>(result.Result); }
public async Task Should_allocate_new_user_for_test_type(TestType testType) { var users = new List <UserDto>(); QueryHandler .Setup(x => x.Handle <GetAllUsersByFilterQuery, List <UserDto> >(It.IsAny <GetAllUsersByFilterQuery>())) .ReturnsAsync(users); const int NUMBER = 1; QueryHandler .Setup(x => x.Handle <GetNextUserNumberByUserTypeQuery, Integer>(It.IsAny <GetNextUserNumberByUserTypeQuery>())) .ReturnsAsync(new Integer(NUMBER)); CommandHandler .Setup(x => x.Handle(It.IsAny <CreateNewUserCommand>())) .Returns(Task.CompletedTask); var user = CreateNewUser(testType, NUMBER); QueryHandler .Setup(x => x.Handle <GetUserByUserTypeAppAndNumberQuery, UserDto>( It.IsAny <GetUserByUserTypeAppAndNumberQuery>())) .ReturnsAsync(user); var allocation = CreateAllocation(user); CommandHandler .Setup(x => x.Handle(It.IsAny <CreateNewAllocationByUserIdCommand>())) .Returns(Task.FromResult(allocation)); QueryHandler .Setup(x => x.Handle <GetUserByIdQuery, UserDto>(It.IsAny <GetUserByIdQuery>())) .ReturnsAsync(user); MockUserApiService .Setup(x => x.CheckUserExistsInAAD(It.IsAny <string>())) .ReturnsAsync(true); CommandHandler .Setup(x => x.Handle(It.IsAny <AllocateByUserIdCommand>())) .Returns(Task.CompletedTask); const int MINUTES = 1; var allocatedUser = await AllocationService.AllocateToService(user.UserType, user.Application, user.TestType, user.IsProdUser, MINUTES); allocatedUser.Should().BeEquivalentTo(user); }
public async Task AllocationShouldBeStopped_Fails_On_Member() { using (var context = await NewParkSharkInMemoryTestContext()) { var parkingLotService = new ParkingLotService(context.ParkSharkDbContext); var memberService = new MemberService(context.ParkSharkDbContext); var allocationService = new AllocationService(context.ParkSharkDbContext, memberService, parkingLotService); var now = DateTime.Now; var allocation = await allocationService.CreateAllocation(new Allocation(1, 1, new LicensePlate("VXK014", "BE"), now)); await Assert.ThrowsExceptionAsync <AllocationException>(async() => await allocationService.StopAllocation(allocation.Id, 3)); } }
public void AllocateTests(int businessSeats, int economySeats, AllocateResult expected) { // Arrange var offers = new[] { 374, 209, 155, 115, 101, 100, 99, 45, 23, 22 }; var spec = new AllocateSpec(offers, businessSeats, economySeats, 100); var allocationService = new AllocationService(); var comparer = new UsageEqualityComparer(); // Act var actual = allocationService.Allocate(spec); // Assert Assert.Equal(actual.BusinessUsage, expected.BusinessUsage, comparer); Assert.Equal(actual.EconomyUsage, expected.EconomyUsage, comparer); }
public void AllocationService_Delete_ShouldBeOk() { Allocation modelo = ObjectMother.GetAllocation(ObjectMother.GetEmployee(), ObjectMother.GetRoom()); modelo.Id = 1; _mockRepository.Setup(m => m.Delete(modelo)); AllocationService service = new AllocationService(_mockRepository.Object); service.Delete(modelo); _mockRepository.Verify(repository => repository.Delete(modelo)); }
private Error copyOrder(CompanyModel company, SplitPurchaseModel model, UserModel user) { var error = new Error(); var updatedOrderNo = LookupService.GetNextSequenceNumber(company, SequenceNumberType.PurchaseOrderNumber, origPoh.OrderNumber.Value, true); var newPohId = db.CopyPurchaseOrder(model.PurchaseOrderHeaderId, updatedOrderNo, true).First().Value; updatedPoh = FindPurchaseOrderHeaderModel(newPohId, company, false); updatedDetails = FindPurchaseOrderDetailListModel(updatedPoh); updatedAllocations = AllocationService.FindAllocationsToPurchaseOrder(updatedPoh).Items; return(error); }
public async Task AllocationGetAllShouldReturnPassive() { using (var context = await NewParkSharkInMemoryTestContext()) { await AllocationTestData(context.ParkSharkDbContext); var parkingLotService = new ParkingLotService(context.ParkSharkDbContext); var memberService = new MemberService(context.ParkSharkDbContext); var allocationService = new AllocationService(context.ParkSharkDbContext, memberService, parkingLotService); var allocations = await allocationService.GetAllocations(status : AllocationStatus.Passive); Assert.AreEqual(2, allocations.Count()); } }
public void GetEnergyConsumedPerTaskTest() { // Arrange List <float> coefficients = new List <float>() { 1, 2, 3 }; float frequency = 1; float runtime = 1; // Act float energyConsumed = AllocationService.GetEnergyConsumedPerTask(coefficients, frequency, runtime); // Assert Assert.AreEqual(6, energyConsumed); }
public async Task Can_Load_Test_Database() { var databaseConnection = new DatabaseConnection(); databaseConnection.ConnectionString = Properties.Settings.Default.TestDatabaseConnectionString; var metadataService = new MetadataService(databaseConnection); var pageReader = new DatabasePageReader(databaseConnection); var pageFreeSpaceService = new PageFreeSpaceService(pageReader); var allocationService = new AllocationService(pageReader); var iamService = new IndexAllocationMapService(pageReader); var service = new DatabaseService(metadataService, allocationService, pageFreeSpaceService, iamService); var result = await service.GetDatabase("InternalsViewerTests"); }
public void FindAllocationListModelTest() { // Gets a list of allocations var testUser = GetTestUser(); var testCompany = GetTestCompany(testUser); var productList = FindProductsForTest(db.FindParentCompany(), 2); Assert.IsTrue(productList.Count() > 0, "Error: No products were returned for the parent company. This could be because the parent company has not been flagged or it has no allocations"); var product = productList[0]; var model = AllocationService.FindAllocationListModel(testCompany, product); var dbData = db.FindAllocationsForCompany(testCompany.Id); int expected = dbData.Count(), actual = model.Items.Count(); Assert.IsTrue(actual == expected, $"Error: {actual} items were found when {expected} were expected"); // Check that all the items match foreach (var item in model.Items) { var dbItem = dbData.Where(m => m.Id == item.Id).FirstOrDefault(); Assert.IsTrue(dbItem != null, "Error: Model item not found in db item list"); var temp = AllocationService.MapToModel(dbItem); AreEqual(item, temp); } // Add another item a make sure it is found product = productList[1]; var newItem = createAllocation(testCompany, product); var error = AllocationService.InsertOrUpdateAllocation(newItem, testUser, ""); Assert.IsTrue(!error.IsError, $"Error: {error.Message}"); model = AllocationService.FindAllocationListModel(testCompany, product); var testItem = model.Items.Where(i => i.Id == newItem.Id).FirstOrDefault(); Assert.IsTrue(testItem != null, "Error: A NULL value was returned when a non-NULL value was expected"); // Delete it and make sure it disappears AllocationService.DeleteAllocation(newItem.Id); model = AllocationService.FindAllocationListModel(testCompany, product); testItem = model.Items.Where(i => i.Id == newItem.Id).FirstOrDefault(); Assert.IsTrue(testItem == null, "Error: A non-NULL value was returned when a NULL value was expected"); }