Пример #1
0
        public async Task AddProductNoCollections()
        {
            var newName = "Product no collections";
            var product = new SimsProduct
            {
                Name              = newName,
                BatchCodes        = "BC1234 BC59867",
                Brand             = "New Brand",
                HostId            = 21,
                CountryOfOriginId = 103,
                Amount            = "7",
                ProductTypeId     = 2,
                AmountUnitTypeId  = 1,
                AdditionalInfo    = "Signal Data",
                PackDescription   = "This is descirption",
            };

            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost       = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var updatedProduct = await simsHost.Signals.Products.Add(product.HostId, product);

                Assert.True(updatedProduct.Name == newName);
            }
        }
Пример #2
0
        public async Task AddProductPackSizesDefaultAmount()
        {
            var product = new SimsProduct
            {
                Name              = "Product Pack Sizes no dates with sizes",
                BatchCodes        = "BC New packers BNA2324",
                Brand             = "A Brand",
                HostId            = 17,
                CountryOfOriginId = 47,
                ProductTypeId     = 2,
                Amount            = "0.0",
                AmountUnitTypeId  = 3,
                AdditionalInfo    = "More Data needed",
                PackDescription   = "This is description",
                PackSizes         = new List <SimsProductPackSize>
                {
                    new SimsProductPackSize {
                        Size = "7", UnitId = 2
                    },
                    new SimsProductPackSize {
                        Size = "18.8", UnitId = 2
                    },
                }
            };

            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost       = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var updatedProduct = await simsHost.Signals.Products.Add(product.HostId, product);

                Assert.True(updatedProduct.PackSizes.Count() == 2 && updatedProduct.Amount == "0.0");
            }
        }
        public async Task AddAddress()
        {
            var testTitle = "Test - New orgnaisations";
            var org       = new SimsAddress
            {
                Title = testTitle,
                //MainContact = "New-Org Smity",
                AddressLine1    = "Address line 1",
                AddressLine2    = "Address line 2",
                PostCode        = "Test post",
                TownCity        = "Test Town City",
                CountryId       = 201,
                County          = "Country",
                TelephoneNumber = "01234567890",
                Contacts        = new List <SimsAddressContact> {
                    new SimsAddressContact {
                        EmailAddress = "email@address", TelephoneNumber = "01234567890", Name = "New-Org Smity", IsMain = true
                    }
                }
            };

            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost     = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var savedAddress = await simsHost.Addresses.Add(org);

                Assert.True(savedAddress.Title == testTitle);
            }
        }
        public async Task AddStakeholderOnlineForm()
        {
            var factCheck           = "New stakeholder";
            var updatedIncidentType = 71;
            var newOnlineForm       = this.BasicForm();

            newOnlineForm.Title = factCheck;

            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost  = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var savedForm = await simsHost.OnlineForms.Add(newOnlineForm);

                var stakeHolders = await simsHost.OnlineForms.Stakeholders.Add(savedForm.CommonId, new SimsStakeholder
                {
                    AddressId       = 42,
                    AddressTitle    = "This sims stakeholders address",
                    DiscriminatorId = 1,
                    Email           = "*****@*****.**",
                    GovDept         = "Gov Dept",
                    Name            = "Sims Stakholeer",
                    Phone           = "01234 Phonme"
                });

                Assert.True(stakeHolders.Id > 0);
            }
        }
        public async Task AddSignalNoSPT()
        {
            var Signal = new SimsSignal
            {
                Title            = "Cheesecake ALERT! No Cheese too much cake. 1 Man Swooned",
                SignalStatusId   = 0,
                Priority         = "HIGH",
                LeadOfficer      = "",
                CountryOfOrigin  = "GB",
                NotifyingCountry = "UK",
                IsEu             = false,
                BaseProduct      = "Cheese",
                Manufacturer     = "Mister cake",
                FoodOrFeed       = "food",
                Hazard           = "involutnary Swooning",
                HazardGroup      = "Panic",
                DataSource       = "Food_Poisoning_Bulletin",
                SourceType       = "Others",
                PublishedDate    = DateTime.Parse("2020-08-19"),
                InsertedDate     = DateTime.Parse("2020-08-20"),
                SourceLink       = "https://foodpoisoningbulletin.com/2020/maison-terre-goldenseal-root-powder-recalled-one-infant-has-died/"
            };

            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost    = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var savedSignal = await simsHost.Signals.Add(Signal);

                //Assert.True(savedSignal.MostUniqueId != Guid.Empty);
            }
        }
Пример #6
0
        public async Task AddProductPackDates()
        {
            var product = new SimsProduct
            {
                Name              = "Product PackDates no sizes with dates",
                BatchCodes        = "BC1234 BC59867",
                Brand             = "New Brand",
                HostId            = 21,
                CountryOfOriginId = 103,
                Amount            = "7",
                ProductTypeId     = 2,
                AmountUnitTypeId  = 1,
                AdditionalInfo    = "More Data needed",
                PackDescription   = "This is description",
                ProductDates      = new List <SimsProductDate>()
                {
                    new SimsProductDate {
                        Date = DateTime.Now, DateTypeId = 2
                    },
                    new SimsProductDate {
                        Date = DateTime.Now, DateTypeId = 3
                    }
                }
            };

            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost       = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var updatedProduct = await simsHost.Signals.Products.Add(product.HostId, product);

                Assert.True(updatedProduct.ProductDates.Count() > 0);
            }
        }
Пример #7
0
 public async Task GetProductAddresses()
 {
     using (var ctx = SeedingConfigData.GetDbContext(this.conn))
     {
         var simsHost  = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
         var addresses = await simsHost.Signals.Products.Fbos.GetAddresses(1);
     }
 }
 public async Task GetNote()
 {
     using (var ctx = SeedingConfigData.GetDbContext(this.conn))
     {
         var simsHost = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
         await simsHost.Incidents.Notes.GetAll(17);
     }
 }
 public async Task AddSignalUser()
 {
     using (var ctx = SeedingConfigData.GetDbContext(this.conn))
     {
         var simsHost = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
         await simsHost.Audit.LogEntry("Signal", "TestPageOverview", 500);
     }
 }
 public async Task AddIncidentUser()
 {
     using (var ctx = SeedingConfigData.GetDbContext(this.conn))
     {
         var simsHost = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
         await simsHost.Audit.LogEntry("Incident", "TestPageAlpha", 44);
     }
 }
        public async Task GetDashboardNoSearchOnlineForm()
        {
            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost        = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var dashboardSearch = await simsHost.OnlineForms.DashboardSearch();

                Assert.True(dashboardSearch.Count() > 0);
            }
        }
        public async Task RemoveIncidentLink()
        {
            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost    = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var removedLink = await simsHost.Incidents.Links.Remove(1, 6);

                Assert.True(removedLink.From == 1 && removedLink.To == 6);
            }
        }
        public async Task FindAddress()
        {
            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var results  = await simsHost.Addresses.FindAddress("black");

                Assert.True(results.ToList().Count > 0);
            }
        }
Пример #14
0
        public async Task GetDisplayProduct()
        {
            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost    = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var prodDisplay = await simsHost.Signals.Products.Get(1);

                Assert.True(!String.IsNullOrEmpty(prodDisplay.Amount) && !String.IsNullOrEmpty(prodDisplay.Name));
            }
        }
 public async Task AddLink()
 {
     using (var ctx = SeedingConfigData.GetDbContext(this.conn))
     {
         var simsHost      = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
         var allAddedLinks = (await simsHost.Signals.Links.Add(1, new int[] { 40, 34, 85 }, "Terry can")).ToList();
         var alLinks       = (await simsHost.Signals.Links.GetForHost(1)).ToList();
         Assert.True(alLinks.Count == 3);
     }
 }
        public async Task NotClosed()
        {
            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost        = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var signalNotClosed = await simsHost.Signals.Exists(19);

                Assert.True(signalNotClosed);
            }
        }
        public async Task DoesNotExist()
        {
            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost     = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var signalExists = await simsHost.Signals.Exists(99999);

                Assert.False(signalExists);
            }
        }
        public async Task GetNote()
        {
            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var notes    = await simsHost.Signals.Notes.GetAll(1);

                Assert.True(notes.ToList().Count > 0);
            }
        }
        public async Task Get()
        {
            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var signal   = await simsHost.Signals.Get(42);

                Assert.True(signal != null && signal.Title.Length > 0);
            }
        }
Пример #20
0
        public async Task DashboardSearchPeanut()
        {
            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var results  = await simsHost.Incidents.DashboardSearch("peanuts");

                Assert.True(results.TotalResults > 0);
            }
        }
Пример #21
0
        public async Task UpdateClosedIncident()
        {
            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var data     = await simsHost.Incidents.Get(59);

                var updated = data.WithTitle("New Title after closing");
                //await Assert.ThrowsAsync<IncidentClosedException>(async () => await simsHost.Incidents.Update(updated));
            }
        }
        public async Task UpdatePublished()
        {
            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var signal   = await simsHost.Signals.Get(13);

                signal.Title         = "Cheesecake ALERT!";
                signal.PublishedDate = DateTime.Parse("01/01/2020");
                await Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await simsHost.Signals.Update(signal));
            }
        }
        public async Task UpdateSignal()
        {
            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var signal   = await simsHost.Signals.Get(23);

                signal.Title = "Cheesecake ALERT!";
                var savedSignal = await simsHost.Signals.Update(signal);

                //Assert.True(savedSignal.MostUniqueId != Guid.Empty);
            }
        }
Пример #24
0
        public async Task CloseIncident()
        {
            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var data     = await simsHost.Incidents.Get(59);

                var updated = data.WithStatus((int)SimsIncidentStatusTypes.Closed);
                var item    = await simsHost.Incidents.Update(updated);

                Assert.True(item.IncidentClosed != null && item.StatusId == (int)SimsIncidentStatusTypes.Closed);
            }
        }
        public async Task AddSignalLink()
        {
            var hostId = 1;

            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                // This returns added links
                var addedLinks  = (await simsHost.Signals.Links.Add(hostId, new int[] { 6, 100, 200 }, "Signals A bonus")).ToList();
                var allLinksSet = await simsHost.Signals.Links.GetForHost(hostId);

                Assert.True(allLinksSet.Count() == 3);
            }
        }
Пример #26
0
        public async Task NullToNullLeadLocalAuthroity()
        {
            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var data     = await simsHost.Incidents.Get(3);

                var updated = data.WithLocalAuthority(null);

                var item = await simsHost.Incidents.Update(updated);

                Assert.True(item.LeadLocalAuthorityId == null);
            }
        }
        public async Task AddNote()
        {
            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                SimsNote newNote = new SimsNote
                {
                    Note = "Signal note added!"
                };

                var simsHost  = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var addedNote = await simsHost.Signals.Notes.Add(1, newNote.Note, (1 + 2 + 4 + 32));

                Assert.True(addedNote.HostId == 1 && addedNote.Note == newNote.Note && 39 == (int)addedNote.Tags);
            }
        }
        public async Task AddOnlineForm()
        {
            var factCheck     = "This is a title";
            var newOnlineForm = this.BasicForm();

            newOnlineForm.Title = factCheck;

            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost  = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                var savedForm = await simsHost.OnlineForms.Add(newOnlineForm);

                Assert.True(savedForm.Title == factCheck);
            }
        }
        public async Task Closed()
        {
            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);
                /// Get a thing and definately close it
                var signalClose = await simsHost.Signals.Get(18);

                signalClose.SignalStatusId = (int)SimsSignalStatusTypes.Closed_Incident;
                await simsHost.Signals.Update(signalClose);

                var signalClosed = await simsHost.Signals.IsClosed(18);

                Assert.True(signalClosed);
            }
        }
Пример #30
0
        public async Task UpdateIncidentSetFbo()
        {
            using (var ctx = SeedingConfigData.GetDbContext(this.conn))
            {
                var simsHost = SimsDbHost.CreateHost(ctx, this.mapper, this.userId);

                BaseIncident incident = await simsHost.Incidents.Get(22);

                // Ensure we have a lead officer and we are open
                var changedIncident = incident
                                      .WithPrincipalFbo(16);
                var updateIncident = await simsHost.Incidents.Update(changedIncident);

                Assert.True(updateIncident.PrincipalFBOId == 16);
            }
        }