public void WhenProductIsUpdatedPermissionShouldBeWrite()
        {
            var authorizer     = new MockAuthorizer();
            var productManager = new ProductManagement(authorizer);
            var product        = new Product();

            productManager.Update(product);

            authorizer.PermissionRequiredInput.Should().Be(Permission.Write);
        }
예제 #2
0
        public void WhenRetrievingProductPermissionShouldBeRead()
        {
            var authorizer     = new MockAuthorizer();
            var productManager = new ProductManagement(authorizer);
            var product        = new Product();

            authorizer.PermissionRequiredInput = Permission.ProductDelete;

            productManager.Read(product);
            authorizer.PermissionRequiredInput.Should().Be(Permission.ProductRead);
        }
        public void WhenRetrievingProductPermissionShouldBeRead()
        {
            //It is going to be difficult to test the read permission.
            //Enums default to the first option of the enum. So, if make sure that Permission.Read is passed in
            //you need to overwrite the default to something else in order to get a failing test.
            var authorizer     = new MockAuthorizer();
            var productManager = new ProductManagement(authorizer);
            var product        = new Product();

            productManager.Read(product);
            authorizer.PermissionRequiredInput.Should().Be(Permission.Read);
        }