Beispiel #1
0
        public void GetLabels()
        {
            var request = new LabelListRequest(this.connectionSettings.AccessToken, this.connectionSettings.ClientSecret);
            var labels  = LabelService.GetLabelsAsync(request).GetAwaiter().GetResult();

            Assert.IsTrue(labels.Data.Count() > 0);
        }
        public void GetLabelsAsync_RemoveLabel()
        {
            // Arrange
            var myLabelsOnDb = new List <SubdomainLabel>
            {
                new SubdomainLabel
                {
                    Label = new Label
                    {
                        Id   = this.labelIdOnDb,
                        Name = "Brute Force"
                    }
                }
            };

            var myNewLabels  = new List <string>();
            var labelService = new LabelService(this.unitOfWork);

            // Act
            var labels = labelService.GetLabelsAsync(myLabelsOnDb, myNewLabels).Result;

            // Assert
            Assert.IsTrue(labels.Count == 0);
            Assert.IsTrue(this.addWasCalled == false);
        }
        public void GetLabelsAsyncAdd_AllNewDuplicateLabel()
        {
            // Arrange
            var myLabelsOnDb = new List <Label>
            {
                new Label
                {
                    Id   = this.labelIdOnDb,
                    Name = "Brute Force"
                }
            };

            var myNewLabels = new List <string> {
                "New Label", "New Label"
            };
            var labelService = new LabelService(this.unitOfWork);

            // Act
            var labels = labelService.GetLabelsAsync(myLabelsOnDb, myNewLabels).Result;

            // Assert
            Assert.IsTrue(labels.Count == 1);
            Assert.IsTrue(this.addWasCalled == true);
        }