Example #1
0
        public void TotalShouldReturnCorrectCount()
        {
            // Arrange
            var firstAccessory = new Accessory {
                Id = 1, Name = "First"
            };
            var secondAccessory = new Accessory {
                Id = 2, Name = "Second"
            };
            var thirdAccessory = new Accessory {
                Id = 3, Name = "Third"
            };

            this.db.AddRange(firstAccessory, secondAccessory, thirdAccessory);
            this.db.SaveChanges();

            var accessoryService = new AdminAccessoryService(this.db);

            // Act
            var result = accessoryService.Total();

            // Assert
            result
            .Should()
            .Equals(3);
        }
Example #2
0
        public void CreateShouldReturnCorrectId()
        {
            // Arrange
            var accessoryService = new AdminAccessoryService(this.db);

            // Act
            var result = accessoryService.Create("test", "test", 1, 2m);

            // Assert
            result
            .Should()
            .Equals(1);
        }
Example #3
0
        public void DeleteShouldReturnFalseIfItIsNotSuccessfull()
        {
            // Arrange
            var accessoryService = new AdminAccessoryService(this.db);

            // Act
            var result = accessoryService.Delete(1);

            // Assert
            result
            .Should()
            .BeFalse();
        }
Example #4
0
        public void EditShouldReturnFalseIfItIsNotSuccessfull()
        {
            // Arrange
            var accessory = new Accessory
            {
                Id   = 1,
                Name = "Test"
            };

            this.db.Accessories.Add(accessory);
            this.db.SaveChanges();

            var accessoryService = new AdminAccessoryService(this.db);

            // Act
            var result = accessoryService.Edit(2, "test", "test", 1, 1m);

            // Assert
            result
            .Should()
            .BeFalse();
        }
Example #5
0
        public void DeleteShouldReturnTrueIfItIsSuccessfull()
        {
            // Arrange
            var accessory = new Accessory
            {
                Id   = 1,
                Name = "Test"
            };

            this.db.Accessories.Add(accessory);
            this.db.SaveChanges();

            var accessoryService = new AdminAccessoryService(this.db);

            // Act
            var result = accessoryService.Delete(1);

            // Assert
            result
            .Should()
            .BeTrue();
        }